All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.directwebremoting.impl.MasterModuleManager Maven / Gradle / Ivy

Go to download

DWR is easy Ajax for Java. It makes it simple to call Java code directly from Javascript. It gets rid of almost all the boilerplate code between the web browser and your Java code. This version 4.0.2 works with Jakarta Servlet 4.0.2.

There is a newer version: 5.0.0
Show newest version
package org.directwebremoting.impl;

import java.util.Collection;
import java.util.HashSet;

import org.directwebremoting.extend.Module;
import org.directwebremoting.extend.ModuleManager;

/**
 * A ModuleManager that delegates to customModuleManager and fallbackModuleManager.
 * @author Mike Wilson [mikewse at g mail dot com]
 */
public class MasterModuleManager implements ModuleManager
{
    /* (non-Javadoc)
     * @see org.directwebremoting.extend.ModuleManager#getModuleNames(boolean)
     */
    public Collection getModuleNames(boolean includeHidden)
    {
        Collection names = new HashSet();
        if (customModuleManager != null)
        {
            names.addAll(customModuleManager.getModuleNames(includeHidden));
        }
        if (fallbackModuleManager != null)
        {
            names.addAll(fallbackModuleManager.getModuleNames(includeHidden));
        }
        return names;
    }

    /* (non-Javadoc)
     * @see org.directwebremoting.extend.ModuleManager#getModule(java.lang.String, boolean)
     */
    public Module getModule(String scriptName, boolean includeHidden)
    {
        Module module = null;
        if (customModuleManager != null)
        {
            module = customModuleManager.getModule(scriptName, includeHidden);
        }
        if (module == null && fallbackModuleManager != null)
        {
            module = fallbackModuleManager.getModule(scriptName, includeHidden);
        }
        return module;
    }

    /**
     * @param moduleManager the moduleManager to set
     */
    public void setCustomModuleManager(ModuleManager moduleManager)
    {
        this.customModuleManager = moduleManager;
    }

    /**
     * @param moduleManager the moduleManager to set
     */
    public void setFallbackModuleManager(ModuleManager moduleManager)
    {
        this.fallbackModuleManager = moduleManager;
    }

    ModuleManager customModuleManager;

    ModuleManager fallbackModuleManager;
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy