Package cu.ftpd.filesystem.metadata

Examples of cu.ftpd.filesystem.metadata.Metadata


     */

    private int calculateNukeSize(File nukedDir, HashMap<String, Long> victims) {
        int totalBytesNuked = 0;
        Directory dir = ServiceManager.getServices().getMetadataHandler().getDirectory(nukedDir);
        Metadata metadata;
        Long bytesForUser;
        for (File file : nukedDir.listFiles(new ForbiddenFilesFilter())) {
            if (file.isDirectory()) {
                totalBytesNuked += calculateNukeSize(file, victims);
            } else {
                totalBytesNuked += file.length();
                metadata = dir.getMetadata(file.getName());
                if (metadata != null) { // if there's no user information for this file, then we don't do anything about it
                    bytesForUser = victims.get(metadata.getUsername());
                    if (bytesForUser == null) {
                        bytesForUser = 0L;
                    }
                    victims.put(metadata.getUsername(), bytesForUser + file.length()); // update the value for the user
                }
            }
        }
        return totalBytesNuked;
    }
View Full Code Here


                        // this will typically happen after a version switch, or if a directory is moved to the site via the shell
                        String username = "unknown";
                        String group = "unknown";
                        Directory directory = ServiceManager.getServices().getMetadataHandler().getDirectory(racedir);
                        if (directory != null) {
                            Metadata m = directory.getMetadata(file.getKey());
                            if (m != null) {
                                username = m.getUsername();
                                group = m.getGroupname();
                            }
                        }
                        completeFiles.put(file.getKey(), new Racer(username, group));
                    }
                }
View Full Code Here

                    group = section.getGroup();
                }

                // next highest default is to check if there is any metadata information registered to the entity.
                if (metadataDirectory != null) {
                    Metadata metadata = metadataDirectory.getMetadata(file.getName());
                    if (metadata != null) { // this shouldn't return some default object, because if it does, it overrides the section owner/group
                        owner = metadata.getUsername();
                        // we can have users without groups, handle this
                        if (!"".equals(metadata.getGroupname()) && metadata.getGroupname() != null) {
                            group = metadata.getGroupname();
                        }
                    } else {
                        //System.out.println("Metadata for " + file.getAbsolutePath() + " was null");
                    }
                } else {
View Full Code Here

            group = section.getGroup();
        }

        // next highest default is to check if there is any metadata information registered to the entity.
        if (metadataDirectory != null) {
            Metadata metadata = metadataDirectory.getMetadata(file.getName());
            if (metadata != null) { // this shouldn't return some default object, because if it does, it overrides the section owner/group
                owner = metadata.getUsername();
                // we can have users without groups, handle this
                if (!"".equals(metadata.getGroupname()) && metadata.getGroupname() != null) {
                    group = metadata.getGroupname();
                }
            } else {
                //System.out.println("Metadata for " + file.getAbsolutePath() + " was null");
            }
        } else {
View Full Code Here

TOP

Related Classes of cu.ftpd.filesystem.metadata.Metadata

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.