Changeset 16190 in josm for trunk


Ignore:
Timestamp:
2020-03-22T01:01:37+01:00 (4 years ago)
Author:
Don-vip
Message:

add missing remote control Javadoc

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  
    2121    private static final List<PermissionPrefWithDefault> PREFS = new ArrayList<>();
    2222
     23    /** Load data from API */
    2324    public static final PermissionPrefWithDefault LOAD_DATA =
    2425            new PermissionPrefWithDefault("remotecontrol.permission.load-data", true, tr("Load data from API"));
     26    /** Import data from URL */
    2527    public static final PermissionPrefWithDefault IMPORT_DATA =
    2628            new PermissionPrefWithDefault("remotecontrol.permission.import", true, tr("Import data from URL"));
     29    /** Open local files */
    2730    public static final PermissionPrefWithDefault OPEN_FILES =
    2831            new PermissionPrefWithDefault("remotecontrol.permission.open-files", false, tr("Open local files"));
     32    /** Load imagery layers */
    2933    public static final PermissionPrefWithDefault LOAD_IMAGERY =
    3034            new PermissionPrefWithDefault("remotecontrol.permission.imagery", true, tr("Load imagery layers"));
     35    /** Change the selection */
    3136    public static final PermissionPrefWithDefault CHANGE_SELECTION =
    3237            new PermissionPrefWithDefault("remotecontrol.permission.change-selection", true, tr("Change the selection"));
     38    /** Change the viewport */
    3339    public static final PermissionPrefWithDefault CHANGE_VIEWPORT =
    3440            new PermissionPrefWithDefault("remotecontrol.permission.change-viewport", true, tr("Change the viewport"));
     41    /** Create new objects */
    3542    public static final PermissionPrefWithDefault CREATE_OBJECTS =
    3643            new PermissionPrefWithDefault("remotecontrol.permission.create-objects", true, tr("Create new objects"));
     44    /** Read protocol version */
    3745    public static final PermissionPrefWithDefault READ_PROTOCOL_VERSION =
    3846            new PermissionPrefWithDefault("remotecontrol.permission.read-protocolversion", true, tr("Read protocol version"));
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r16147 r16190  
    389389    }
    390390
     391    /**
     392     * Returns the JSON information for all handlers.
     393     * @return the JSON information for all handlers
     394     */
    391395    public static String getHandlersInfoAsJSON() {
    392396        StringBuilder r = new StringBuilder();
     
    407411    }
    408412
     413    /**
     414     * Returns the JSON information for a given handler.
     415     * @param cmd handler key
     416     * @return JSON information for the given handler
     417     */
    409418    public static String getHandlerInfoAsJSON(String cmd) {
    410419        try (StringWriter w = new StringWriter()) {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r15720 r16190  
    3838public abstract class RequestHandler {
    3939
     40    /** preference key to determine if all Remote Control actions must be confirmed manually */
    4041    public static final String globalConfirmationKey = "remotecontrol.always-confirm";
     42    /** whether remote control actions must be confirmed manually by default */
    4143    public static final boolean globalConfirmationDefault = false;
     44    /** preference key to determine if remote control loads data in a new layer */
    4245    public static final String loadInNewLayerKey = "remotecontrol.new-layer";
     46    /** whether remote control loads data in a new layer by default */
    4347    public static final boolean loadInNewLayerDefault = false;
    4448
     
    123127    public abstract PermissionPrefWithDefault getPermissionPref();
    124128
     129    /**
     130     * Returns the mandatory parameters. Both used to enfore their presence at runtime and for documentation.
     131     * @return the mandatory parameters
     132     */
    125133    public abstract String[] getMandatoryParams();
    126134
     135    /**
     136     * Returns the optional parameters. Both used to enfore their presence at runtime and for documentation.
     137     * @return the optional parameters
     138     */
    127139    public String[] getOptionalParams() {
    128140        return new String[0];
    129141    }
    130142
     143    /**
     144     * Returns usage description, for bad requests and documentation.
     145     * @return usage description
     146     */
    131147    public String getUsage() {
    132148        return null;
    133149    }
    134150
     151    /**
     152     * Returns usage examples, for bad requests and documentation.
     153     * @return Usage examples
     154     */
    135155    public String[] getUsageExamples() {
    136156        return new String[0];
     
    295315    }
    296316
     317    /**
     318     * Returns the response content.
     319     * @return the response content
     320     */
    297321    public String getContent() {
    298322        return content;
    299323    }
    300324
     325    /**
     326     * Returns the response content type.
     327     * @return the response content type
     328     */
    301329    public String getContentType() {
    302330        return contentType;
     
    337365    }
    338366
     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     */
    339371    public void setSender(String sender) {
    340372        this.sender = sender;
    341373    }
    342374
     375    /**
     376     * Base exception of remote control handler errors.
     377     */
    343378    public static class RequestHandlerException extends Exception {
    344379
     
    369404    }
    370405
     406    /**
     407     * Error raised when a runtime error occurred.
     408     */
    371409    public static class RequestHandlerErrorException extends RequestHandlerException {
    372410
     
    380418    }
    381419
     420    /**
     421     * Error raised for bad requests.
     422     */
    382423    public static class RequestHandlerBadRequestException extends RequestHandlerException {
    383424
     
    408449    }
    409450
     451    /**
     452     * Error raised for forbidden usage.
     453     */
    410454    public static class RequestHandlerForbiddenException extends RequestHandlerException {
    411455
     
    419463    }
    420464
     465    /**
     466     * Handler that takes an URL as parameter.
     467     */
    421468    public abstract static class RawURLParseRequestHandler extends RequestHandler {
    422469        @Override
Note: See TracChangeset for help on using the changeset viewer.