Package cu.ftpd.modules

Examples of cu.ftpd.modules.Module


        configureUserbase();
        siteCommandHandler.registerAction("chown", new Chown()); // note: only use this when we have disk (cuftpd) AND a cuftpd userbase. (create a different method body when we're doing a CubncServices object)
        configureUserStatistics();
        configureModules();
        if (modules.containsKey("zipscript")) {
            Module zipscript = modules.get("zipscript");
            if (zipscript instanceof ZipscriptModule) {
                ZipscriptModule zm = (ZipscriptModule)zipscript;
                setTransferPostProcessor(zm.getZipscript());
            }
        }
View Full Code Here


        return metadataHandler;
    }

    // Modules
    protected void configureModules() throws ConfigurationException {
        Module module;

        // _todo: use this style of configuration whereever we have enumerations, like the site-commands and the event-handlers
        // actually, NO, we're not going to use the .getNode() and then iterate over them approach, because we can't get named access to any nodes, which is utterly useless.
        // Node modulesNode = settings.getNode("/modules");
        // The only thing we get that kind of access from is an attribute list

        String moduleName;
        try {
            int i = 1;
            String clazz;
            boolean active;
            while(true) {
                // loop over the sections in the file
                moduleName = settings.get("/modules/module[" + i + "]/name");
                if (moduleName == null || "".equals(moduleName)) {
                    break;
                }
                clazz = settings.get("/modules/module[" + i + "]/class");
                active = settings.getBoolean("/modules/module[" + i + "]/active");
                if (active) {
                    // use a custom class loader to load the file, in case we are using classes from another jar.
                    Class c = customClassLoader.loadClass(clazz);
                    if (Module.class.isAssignableFrom(c)) {
                        module = (Module)c.newInstance();
                        module.initialize(new XMLSettings(settings.getNode("/modules/module[" + i + "]/settings")));
                        module.registerActions(siteCommandHandler);
                        module.registerEventHandlers(eventHandler);
                        modules.put(moduleName, module);
                    } else {
                        throw new ConfigurationException("Class " + clazz + " does not implement interface " + Module.class.toString());
                    }
                }
View Full Code Here

TOP

Related Classes of cu.ftpd.modules.Module

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.