Package cu.ftpd.events

Examples of cu.ftpd.events.Event


                            if (!ForbiddenFilesFilter.getForbiddenFiles().contains(filename)) {
                                if (user.hasLeech() || file.length() < user.getCredits()) {
                                    if (remoteHost != null) {
                                        // if we have an address, and we are either transferring data to the same host that we are connecting from, or we have permission to FXPUP, then continue
                                        if (remoteHost.equals(connection.getClientHost()) || ServiceManager.getServices().getPermissions().hasPermission(ActionPermission.FXPDOWNLOAD, ftpPathToFile, user)) {
                                            Event event = EventFactory.download(user, fs, file, remoteHost, 0, 0, "PENDING");
                                            boolean proceed = ServiceManager.getServices().getEventHandler().handleBeforeEvent(event, connection);
                                            if (proceed) {
                                                section = fs.getSection(file);
                                                in = new FileInputStream(file);
                                                createTransfer();
View Full Code Here


    public void error(Exception e, long bytesTransferred, long transferTime) {
        close();
        log(bytesTransferred, transferTime);
        connection.reportTransferFailure(e.getMessage());
        Event event = EventFactory.download(user, fs, file, remoteHost, bytesTransferred, transferTime, "FAILED");
        ServiceManager.getServices().getEventHandler().handleAfterEvent(event);

    }
View Full Code Here

    public void complete(long bytesTransferred, long transferTime) {
        close();
        log(bytesTransferred, transferTime);
        connection.respond("226- " + fs.getType() + " transfer of " + filename + " completed.");
        connection.statline(transfer.getSpeed());
        Event event = EventFactory.download(user, fs, file, remoteHost, bytesTransferred, transferTime, "COMPLETE");
        ServiceManager.getServices().getEventHandler().handleAfterEvent(event);
    }
View Full Code Here

                            if (file.getParentFile().canWrite()) {
                                if (!file.exists() || /* file.exists() && */ hasModifyPermission(file) ) {
                                    if (remoteHost != null) {
                                        // if we have an address, and we are either transferring data to the same host that we are connecting from, or we have permission to FXPUP, then continue
                                        if (remoteHost.equals(connection.getClientHost()) || ServiceManager.getServices().getPermissions().hasPermission(ActionPermission.FXPUPLOAD, ftpPathToFile, user)) {
                                            Event event = EventFactory.upload(user, fs, file, remoteHost, 0, 0, null, "PENDING");

                                            boolean proceed = ServiceManager.getServices().getEventHandler().handleBeforeEvent(event, connection);
                                            //boolean proceed = ServiceManager.getServices().getEventHandler().handleBeforeEvent(new FileTransferEvent(Event.UPLOAD, user, fs.getRealParentWorkingDirectory(), FileTransferEvent.PENDING, 0, 0, file, fs.getType(), (remoteHost == null ? "n/a - connection failure" : remoteHost.getHostAddress())), connection);
                                            if (proceed) {
                                                // NOTE: dupecheck is handled as an event handler
View Full Code Here

        // (if so, then we can probably drop a lot of data from the FileTransferEvent)
        // since it happens both at failure and and success, and because it is such an integral part of the service, the xferlog stays here
//        xferlog(bytesTransferred, transferTime);
        ProcessResult pcr = postProcess(bytesTransferred, transferTime);
        connection.reportTransferFailure(e.getMessage());
        Event event = EventFactory.upload(user, fs, file, remoteHost, bytesTransferred, transferTime, pcr, "FAILED");
        ServiceManager.getServices().getEventHandler().handleAfterEvent(event);
    }
View Full Code Here

//        xferlog(bytesTransferred, transferTime);
        ProcessResult pcr = postProcess(bytesTransferred, transferTime);
        connection.reply(226, pcr.message, true); // if this wasn't a race, the raceMessage will be null, and .reply(..) will print nothing
        connection.respond("226- " + fs.getType() + " transfer of " + filename + " complete.");
        connection.statline(transfer.getSpeed());
        Event event = EventFactory.upload(user, fs, file, remoteHost, bytesTransferred, transferTime, pcr, "COMPLETE");
        ServiceManager.getServices().getEventHandler().handleAfterEvent(event);
    }
View Full Code Here

        // do a recursive delete, since we can't delete directories if they are not empty.
        boolean deleted = recursiveDelete(file);
        if (deleted) {
            ServiceManager.getServices().getMetadataHandler().delete(file); // this doesn't rely on the existence of the file, so it still works

            Event event;
            if (wasDir) {
                event = new Event(Event.REMOVE_DIRECTORY, user, getRealParentWorkingDirectoryPath(), getFtpParentWorkingDirectory());
                event.setProperty("dirlog.deleteRecursively", "true");
            } else {
                event = new Event(Event.DELETE_FILE, user, getRealParentWorkingDirectoryPath(), getFtpParentWorkingDirectory());
                event.setProperty("file.size", String.valueOf(length));
            }
            event.setProperty("file.path.real", resolveRealPath(path));
            event.setProperty("file.path.ftp", resolveFtpPath(path));
            event.setProperty("site.section", getSection(path).getName());
            ServiceManager.getServices().getEventHandler().handleAfterEvent(event);
        } else {
            if (fileMissing) {
                // we do this here, so that we can delete orphaned symlinks, even though they report as being non-existent.
                throw new FileNotFoundException("File not deleted: file not found: " + resolvePath(file));
View Full Code Here

     * The executing code for this method was moved to its own class, for clarity.
     *
     * @param parameters the parameters to the command, including the command name.
     */
    public void site(String parameters) {
        Event event = EventFactory.siteCommand(user, fs, parameters);
        boolean ok = ServiceManager.getServices().getEventHandler().handleBeforeEvent(event, this);
        if (ok) {
            siteCommandHandler.execute(this, user, fs, parameters);
            ServiceManager.getServices().getEventHandler().handleAfterEvent(event);
        }
View Full Code Here

    }

    protected void dele(String path) {
        if (path != null) {
            try {
                Event event = EventFactory.deleteFile(user, fs, path);

                boolean proceed = ServiceManager.getServices().getEventHandler().handleBeforeEvent(event, this);
                if (proceed) {
                    fs.delete(path);
                    respond("250 File deleted.");
View Full Code Here

    }

    protected void rmd(String path) {
        if (path != null) {
            try {
                Event event = EventFactory.removeDirectory(user, fs, path);

                boolean proceed = ServiceManager.getServices().getEventHandler().handleBeforeEvent(event, this);
                if (proceed) {
                    fs.rmd(path);
                    respond("250 Directory deleted.");
View Full Code Here

TOP

Related Classes of cu.ftpd.events.Event

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.