Package cu.ftpd.modules.requests

Examples of cu.ftpd.modules.requests.Request


        this.autoApprove = autoApprove;
        load();
    }

    public void request(User user, String request) {
        Request r = new Request(System.currentTimeMillis(), user.getUsername(), request);
        requests.add(r);
        if (autoApprove) {
            r.setApproved(true);
        }
        save();
        // _todo: make a reqdel command
        // _todo: allow setting for dirs to be automatically created (for this we need a pattern (user setable? heaven forbid) as well as a setting in the settings)(as well as WHERE these dirs should be created)
        // if we do this, do we auto-rename directories that are filled?
View Full Code Here


    public boolean fillRequest(User filler, int requestNumber) {
        // even though doing .get(int) isn't particularly effective on a LinkedList, this operation happens rarely, and we don't need to shift the entire array down, which would be even more costly
        synchronized (requests) { // added this lock here to keep .remove() from throwing an IndexOutOfBoundsException.
            if (requestNumber <= requests.size() - 1 && requestNumber >= 0) {
                Request r = requests.remove(requestNumber);
                save();
                logRequestFilledToEventLog(filler, r);
                return true;
            } else {
                return false;
View Full Code Here

    }

    public boolean approve(User approver, int requestNumber, boolean approved) {
        synchronized (requests) {
            if (requestNumber <= requests.size() - 1 && requestNumber >= 0) {
                Request r = requests.get(requestNumber);
                r.setApproved(approved);
                save();
                logRequestApprovedToEventLog(approver, r);
                return true;
            } else {
                return false;
View Full Code Here

            in = new BufferedReader(new InputStreamReader(new FileInputStream(log)));
            String line;
            while ((line = in.readLine()) != null) {
                String[] request = line.split(";");
                // time + ";" + requester + ";" + approved + ";" + description;
                Request r = new Request(Long.parseLong(request[0]), request[1], request[3]);
                r.setApproved(Boolean.parseBoolean(request[2]));
                requests.add(r);
            }
        } catch (IOException e) {
            // should we even report this?
            Logging.getErrorLog().reportCritical("Error while loading request log: " + e.getMessage());
View Full Code Here

TOP

Related Classes of cu.ftpd.modules.requests.Request

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.