Changeset 16190 in josm for trunk/src/org
- Timestamp:
- 2020-03-22T01:01:37+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io/remotecontrol
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/remotecontrol/PermissionPrefWithDefault.java
r15507 r16190 21 21 private static final List<PermissionPrefWithDefault> PREFS = new ArrayList<>(); 22 22 23 /** Load data from API */ 23 24 public static final PermissionPrefWithDefault LOAD_DATA = 24 25 new PermissionPrefWithDefault("remotecontrol.permission.load-data", true, tr("Load data from API")); 26 /** Import data from URL */ 25 27 public static final PermissionPrefWithDefault IMPORT_DATA = 26 28 new PermissionPrefWithDefault("remotecontrol.permission.import", true, tr("Import data from URL")); 29 /** Open local files */ 27 30 public static final PermissionPrefWithDefault OPEN_FILES = 28 31 new PermissionPrefWithDefault("remotecontrol.permission.open-files", false, tr("Open local files")); 32 /** Load imagery layers */ 29 33 public static final PermissionPrefWithDefault LOAD_IMAGERY = 30 34 new PermissionPrefWithDefault("remotecontrol.permission.imagery", true, tr("Load imagery layers")); 35 /** Change the selection */ 31 36 public static final PermissionPrefWithDefault CHANGE_SELECTION = 32 37 new PermissionPrefWithDefault("remotecontrol.permission.change-selection", true, tr("Change the selection")); 38 /** Change the viewport */ 33 39 public static final PermissionPrefWithDefault CHANGE_VIEWPORT = 34 40 new PermissionPrefWithDefault("remotecontrol.permission.change-viewport", true, tr("Change the viewport")); 41 /** Create new objects */ 35 42 public static final PermissionPrefWithDefault CREATE_OBJECTS = 36 43 new PermissionPrefWithDefault("remotecontrol.permission.create-objects", true, tr("Create new objects")); 44 /** Read protocol version */ 37 45 public static final PermissionPrefWithDefault READ_PROTOCOL_VERSION = 38 46 new PermissionPrefWithDefault("remotecontrol.permission.read-protocolversion", true, tr("Read protocol version")); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r16147 r16190 389 389 } 390 390 391 /** 392 * Returns the JSON information for all handlers. 393 * @return the JSON information for all handlers 394 */ 391 395 public static String getHandlersInfoAsJSON() { 392 396 StringBuilder r = new StringBuilder(); … … 407 411 } 408 412 413 /** 414 * Returns the JSON information for a given handler. 415 * @param cmd handler key 416 * @return JSON information for the given handler 417 */ 409 418 public static String getHandlerInfoAsJSON(String cmd) { 410 419 try (StringWriter w = new StringWriter()) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r15720 r16190 38 38 public abstract class RequestHandler { 39 39 40 /** preference key to determine if all Remote Control actions must be confirmed manually */ 40 41 public static final String globalConfirmationKey = "remotecontrol.always-confirm"; 42 /** whether remote control actions must be confirmed manually by default */ 41 43 public static final boolean globalConfirmationDefault = false; 44 /** preference key to determine if remote control loads data in a new layer */ 42 45 public static final String loadInNewLayerKey = "remotecontrol.new-layer"; 46 /** whether remote control loads data in a new layer by default */ 43 47 public static final boolean loadInNewLayerDefault = false; 44 48 … … 123 127 public abstract PermissionPrefWithDefault getPermissionPref(); 124 128 129 /** 130 * Returns the mandatory parameters. Both used to enfore their presence at runtime and for documentation. 131 * @return the mandatory parameters 132 */ 125 133 public abstract String[] getMandatoryParams(); 126 134 135 /** 136 * Returns the optional parameters. Both used to enfore their presence at runtime and for documentation. 137 * @return the optional parameters 138 */ 127 139 public String[] getOptionalParams() { 128 140 return new String[0]; 129 141 } 130 142 143 /** 144 * Returns usage description, for bad requests and documentation. 145 * @return usage description 146 */ 131 147 public String getUsage() { 132 148 return null; 133 149 } 134 150 151 /** 152 * Returns usage examples, for bad requests and documentation. 153 * @return Usage examples 154 */ 135 155 public String[] getUsageExamples() { 136 156 return new String[0]; … … 295 315 } 296 316 317 /** 318 * Returns the response content. 319 * @return the response content 320 */ 297 321 public String getContent() { 298 322 return content; 299 323 } 300 324 325 /** 326 * Returns the response content type. 327 * @return the response content type 328 */ 301 329 public String getContentType() { 302 330 return contentType; … … 337 365 } 338 366 367 /** 368 * Sets who sent the request (the host from referer header or IP of request sender) 369 * @param sender the host from referer header or IP of request sender 370 */ 339 371 public void setSender(String sender) { 340 372 this.sender = sender; 341 373 } 342 374 375 /** 376 * Base exception of remote control handler errors. 377 */ 343 378 public static class RequestHandlerException extends Exception { 344 379 … … 369 404 } 370 405 406 /** 407 * Error raised when a runtime error occurred. 408 */ 371 409 public static class RequestHandlerErrorException extends RequestHandlerException { 372 410 … … 380 418 } 381 419 420 /** 421 * Error raised for bad requests. 422 */ 382 423 public static class RequestHandlerBadRequestException extends RequestHandlerException { 383 424 … … 408 449 } 409 450 451 /** 452 * Error raised for forbidden usage. 453 */ 410 454 public static class RequestHandlerForbiddenException extends RequestHandlerException { 411 455 … … 419 463 } 420 464 465 /** 466 * Handler that takes an URL as parameter. 467 */ 421 468 public abstract static class RawURLParseRequestHandler extends RequestHandler { 422 469 @Override
Note:
See TracChangeset
for help on using the changeset viewer.