Von Version < 1.10 >
bearbeitet von awa
am 12.03.2020, 11:02
Auf Version < 1.14 >
bearbeitet von awa
am 12.03.2020, 12:00
< >
Änderungskommentar: Es gibt keinen Kommentar für diese Version

Zusammenfassung

Details

Seiteneigenschaften
Inhalt
... ... @@ -16,8 +16,19 @@
16 16  
17 17  Standardmäßig ist eine Servlet-Aktion für alle frei zugänglich. Da es in der Regel unerwünscht ist, dass jeder (auch unangemeldete) Nutzer Plugins installieren kann, kann das Deploy-Plugin durch ein Passwort abgesichert werden. Dazu muss in der Plugin-Konfiguration der Passwort-Hash hinterlegt werden und das Passwort dann im HTTP-POST-Request mitgesendet werden.
18 18  
19 -== HTTP-Request-Aufbau ==
19 +== Plugin-Konfiguration ==
20 20  
21 +Am Plugin selber kann konfiguriert werden, ob das Deploy-Servlet durch ein Passwort geschützt werden soll. Dazu gibt es die eine Plugin-Eigenschaft //token//, diese hat das folgende Format
22 +
23 +> hash_method:hashed_value
24 +
25 +Folgende Hash-Methoden stehen zur Verfügung:
26 +
27 +; plain
28 +: asd
29 +
30 +== Deploy-Servlet ==
31 +
21 21  Im Folgenden wird der Aufbau des HTTP-Requests beschrieben, um ein Plugin zu installieren, zu aktualisieren oder zu löschen.
22 22  
23 23  Es muss immer ein HTTP-Post-Request verwendet werden und [[sich an folgende URL richten>>doc:Formcycle.PluginDevelopment.Types.IPluginServletAction]] (Namen des FORMCYCLE-Servers entsprechend anpassen):
... ... @@ -28,7 +28,7 @@
28 28  
29 29  Die //client-id// muss nicht angegeben werden, wenn das Plugin als System-Plugin installiert ist.
30 30  
31 -=== Request-Parameter
42 +=== Request-Parameter ===
32 32  
33 33  Die Parameter können direkt als URL-Parameter, als //multipart/form-data// oder als //application/x-www-form-urlencoded// übergeben werden. Folgende Parameter werden vom Deploy-Plugin unterstützt und können übergeben werden:
34 34  
... ... @@ -57,9 +57,9 @@
57 57  :; plugin-ident=manifest
58 58  :: //plugin-identifier// muss den Namen der Manifest-Eigenschaft und dessen Wert enthalten, im Format //ATTRIBUTE_NAME=VALUE//. Wird zum Beispiel //Implementation-Title=com.example.fc.plugin:my-plugin// übergeben wird, wird nach einem existierenden Plugin gesucht, welches im Manifest in der Eigenschaft //Implementation-Title// den Wert //com.example.fc.plugin:my-plugin// stehen hat.
59 59  :; plugin-ident=id
60 -:: //plugin-identifier// muss die gewünschte ID des Plugins enthalten, etwa //53// oder /893//.
71 +:: //plugin-identifier// muss die gewünschte ID des Plugins enthalten, etwa //53// oder /893//.//
61 61  :; plugin-ident=name
62 -:: //plugin-identifier// muss den gewünschten Names des Plugins enthalten, etwa //my-plugin.jar// oder /foobar.jar//.
73 +:: //plugin-identifier// muss den gewünschten Names des Plugins enthalten, etwa //my-plugin.jar// oder /foobar.jar//.//
63 63  :; plugin-ident=uuid
64 64  :: //plugin-identifier// muss die gewünschte UUID des Plugins enthalten, etwa //03022599-903d-429b-9822-80a324a542fc//.
65 65  Andernfalls wird das Plugin installiert, falls noch nicht vorhanden, oder aktualisiert, falls vorhanden.
... ... @@ -71,13 +71,74 @@
71 71  : Entweder //true// oder //false//. Ist diese Option auf //true// gesetzt und existiert das Plugin noch nicht (bezüglich der angegebenen //plugin-ident// und //plugin-identifier//), wird das Plugin nicht neu installiert und eine Fehlermeldung zurückgegeben. ; locale
72 72  : Die Sprache, welche während der Installation, Aktualisierung oder Löschung des Plugins verwendet werden soll, etwa //en// oder //de//. Beeinflusst nur einige Fehlermeldungen und kann in der Regel weggelassen werden.
73 73  
74 -=== Deploy-Action
85 +=== Deploy-Action ===
75 75  
76 76  Der Wert des Parameters //deploy-action// gibt an, was genau mit dem Plugin geschehen soll. Es gibt dabei die folgenden Möglichkeiten:
77 77  
89 +; save
90 +: Überträgt das angegebene Plugin auf das FORMCYCLE-System. Es muss hierbei eine JAR-Datei übertragen werden. Falls das Plugin noch nicht existiert (und der Parameter //disallow-install// nicht gesetzt ist), wird das Plugin neu installiert und ist dann aktiviert. Andernfalls, falls das Plugin bereits existiert, wird es aktualisiert, dabei bleibt das Plugin aktiviert oder deaktiviert.
91 +
92 +(((
93 +{{code language="bash"}}
94 +# Installiert oder aktualisiert das Plugin mit dem Implementation-Title com.example:plugin
95 + curl -X POST \
96 + -F deploy-action=save \
97 + -F token=admin \
98 + -F plugin-ident=manifest \
99 + -F plugin-identifier=Implementation-Title=com.example:plugin \
100 + -F "jar-file=@my-plugin.jar" \
101 + "http://localhost:8080/formcycle/plugin?client-id=154&name=deploy-plugin"
102 +{{/code}}
103 +)))
104 +
105 +; delete
106 +: Löscht das angegebene Plugin. Es darf hierbei keine JAR-Datei übertragen werden. Existiert das angegebene Plugin nicht, wird ein Fehler zurückgegeben. Beispiel:
107 +
108 +(((
109 +{{code language="bash"}}
110 +# Löscht das Plugin mit dem Implementation-Title com.example:plugin
111 + curl -X POST \
112 + -F deploy-action=delete \
113 + -F token=admin \
114 + -F plugin-ident=manifest \
115 + -F plugin-identifier=Implementation-Title=com.example:plugin \
116 + "http://localhost:8080/formcycle/plugin?client-id=154&name=deploy-plugin"
117 +{{/code}}
118 +)))
119 +
120 +; activate
121 +: Aktiviert das angegebene Plugin. Es darf hierbei keine JAR-Datei übertragen werden. Existiert das angegebene Plugin nicht, wird ein Fehler zurückgegeben. Ist das Plugin bereits aktiviert, wird nicht getan und ein Erfolg zurückgegeben. Beispiel:
122 +
123 +(((
124 +{{code language="bash"}}
125 +# Aktiviert das Plugin mit dem Implementation-Title com.example:plugin
126 + curl -X POST \
127 + -F deploy-action=activate \
128 + -F token=admin \
129 + -F plugin-ident=manifest \
130 + -F plugin-identifier=Implementation-Title=com.example:plugin \
131 + "http://localhost:8080/formcycle/plugin?client-id=154&name=deploy-plugin"
132 +{{/code}}
133 +)))
134 +
135 +; deactivate
136 +: Deaktiviert das angegebene Plugin. Es darf hierbei keine JAR-Datei übertragen werden. Existiert das angegebene Plugin nicht, wird ein Fehler zurückgegeben. Ist das Plugin bereits deaktiviert, wird nicht getan und ein Erfolg zurückgegeben. Beispiel:
137 +
138 +(((
139 +{{code language="bash"}}
140 +# Deaktiviert oder aktualisiert das Plugin mit dem Implementation-Title com.example:plugin
141 + curl -X POST \
142 + -F deploy-action=deactivate \
143 + -F token=admin \
144 + -F plugin-ident=manifest \
145 + -F plugin-identifier=Implementation-Title=com.example:plugin \
146 + "http://localhost:8080/formcycle/plugin?client-id=154&name=deploy-plugin"
147 +{{/code}}
148 +)))
149 +
78 78  ; update-properties
79 79  : Aktualisiert die Eigenschaften des angegebenen Plugins. Es darf hierbei keine JAR-Datei übertragen werden. Entweder die Eigenschaft //clear-properties// oder //property// sollte gesetzt sein. Existiert das angegebene Plugin nicht, wird ein Fehler zurückgegeben. Beispiel:
80 - (((
152 +(((
81 81  {{code language="bash"}}
82 82  # Löscht alle vorhandenen Plugin-Eigenschaften und setzt dann die Eigenschaft "foo" auf den Wert "bar"
83 83   curl -X POST \
... ... @@ -88,10 +88,161 @@
88 88   -F clear-properties=false \
89 89   -F property=foo=bar \
90 90   "http://localhost:8080/formcycle/plugin?client-id=154&name=deploy-plugin"
91 -{{/code}})))
163 +{{/code}}
164 +)))
92 92  
93 -== Response
166 +== Response ==
94 94  
168 +Das Deploy-Plugin liefert einen Statuscode und ein JSON-Objekt mit den Details zurück. Der Status-Code ist 2xx, falls das Deploy-Plugin erfolgreich ausgeführt wurde.
95 95  
170 +Das JSON-Objekt hat dabei [[die folgende Struktur>>https://json-schema.org/]]:
96 96  
172 +{{code language="json"}}
173 +{
174 + "$schema": "http://json-schema.org/schema",
175 + "description": "Represents the response of the deploy plugin servlet.",
176 + "required": [
177 + "success",
178 + "statusCode",
179 + "details",
180 + "message",
181 + "requestParameters"
182 + ],
183 + "properties": {
184 + "success": {
185 + "type": "boolean",
186 + "title": "Success status",
187 + "description": "true if the deploy plugin servlet was executed successfully, or false otherwise"
188 + },
189 + "statusCode": {
190 + "type": "number",
191 + "title": "HTTP status code",
192 + "description": "The status code of the HTTP request that contains this response."
193 + },
194 + "details": {
195 + "type": "object",
196 + "title": "Result details",
197 + "description": "Detailed information about the plugin processed by the deploy plugin servlet.",
198 + "oneOf": [
199 + {
200 + "description": "If the deploy plugin servlet was successful, details about the successfully executed action.",
201 + "required": [
202 + "id",
203 + "uuid",
204 + "name",
205 + "active",
206 + "message"
207 + ],
208 + "properties": {
209 + "id": {
210 + "type": "number",
211 + "title": "Plugin ID",
212 + "description": "The database ID of the processed plugin."
213 + },
214 + "uuid": {
215 + "type": "string",
216 + "title": "Plugin UUID",
217 + "description": "The UUID of the processed plugin."
218 + },
219 + "name": {
220 + "type": "string",
221 + "title": "Plugin name",
222 + "description": "The name of the processed plugin, i.e. the file name of the plugin JAR file."
223 + },
224 + "active": {
225 + "type": "boolean",
226 + "title": "Plugin activation status",
227 + "description": "true if the plugin is now active, false if it is now inactive."
228 + },
229 + "message": {
230 + "type": "string",
231 + "title": "Result message",
232 + "description": "Human-readable message describing the performed action."
233 + }
234 + }
235 + },
236 + {
237 + "required": [
238 + "exceptionType",
239 + "exceptionMessage"
240 + ],
241 + "description": "If the deploy plugin servlet was unsuccessful, details about the error that occurred.",
242 + "properties": {
243 + "exceptionType": {
244 + "type": "string",
245 + "title": "Exception type",
246 + "description": "The type of the error that occurred, a fully-classified name of the Java exception class."
247 + },
248 + "exceptionMessage": {
249 + "type": "string",
250 + "title": "Exception message",
251 + "description": "The human-readable message of the error that occurred."
252 + }
253 + }
254 + }
255 + ]
256 + },
257 + "message": {
258 + "type": "string",
259 + "title": "Result message",
260 + "description": "A human-readable message that describes this result."
261 + },
262 + "requestParameters": {
263 + "type": "object",
264 + "title": "Request parameters",
265 + "description": "The parameters of the request that triggered this response."
266 + }
267 + }
268 +}
269 +{{/code}}
270 +
271 +Beispiel für die Antwort beim Aktualisieren eines Plugins:
272 +
273 +{{code language="json"}}
274 +{
275 + "success": true,
276 + "requestParameters": {
277 + "plugin-ident": ["manifest"],
278 + "name": ["deploy-plugin"],
279 + "client-id": ["1"],
280 + "deploy-action": ["save"],
281 + "plugin-identifier": ["Implementation-Title=com.example:plugin"],
282 + "token": ["admin"]
283 + },
284 + "details": {
285 + "name": "my-plugin.jar",
286 + "active": true,
287 + "id": 203,
288 + "message": "Plugin saved successfully.",
289 + "uuid": "2fe3e1ba-cb32-434e-9f59-4422f8dabcad"
290 + },
291 + "message": "Plugin saved successfully.",
292 + "statusCode": 200
293 +}
294 +{{/code}}
295 +
296 +Beispiel für die Antwort beim Löschen, falls das angegebene Plugin nicht gefunden wurde:
297 +
298 +{{code language="json"}}
299 +{
300 + "success": false,
301 + "requestParameters": {
302 + "plugin-ident": ["manifest"],
303 + "name": ["deploy-plugin"],
304 + "client-id": ["1"],
305 + "deploy-action": ["delete"],
306 + "plugin-identifier": ["Implementation-Title=com.example:plugin"],
307 + "token": ["admin"]
308 + },
309 + "details": {
310 + "exceptionType": "java.lang.IllegalArgumentException",
311 + "exceptionMessage": "Deploy action 'delete' requires an existing pluign, but none was found."
312 + },
313 + "message": "class java.lang.IllegalArgumentException: Deploy action 'delete' requires an existing pluign, but none was found.",
314 + "statusCode": 404
315 +}
316 +{{/code}}
317 +
318 +
97 97  == Beispiel für Maven ==
320 +
Copyright 2000-2025