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

org.directwebremoting.extend.CreatorManager 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 boiler plate code between the web browser and your Java code.

There is a newer version: 3.0.2-RELEASE
Show newest version
/*
 * Copyright 2005 Joe Walker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.directwebremoting.extend;

import java.util.Collection;
import java.util.Map;

/**
 * A class to manage the types of creators and the instantiated creators.
 * @author Joe Walker [joe at getahead dot ltd dot uk]
 */
public interface CreatorManager
{
    /**
     * Debug mode allows access to the list of creator names
     * @return Are we in debug mode
     * @see CreatorManager#getCreatorNames()
     */
    boolean isDebug();

    /**
     * In init mode, add a new type of creator
     * @param typeName The name of the new creator type
     * @param className The class that we create
     */
    void addCreatorType(String typeName, String className);

    /**
     * Add a new creator
     * @param scriptName The name of the creator to Javascript
     * @param typeName The class to use as a creator
     * @param params The extra parameters to allow the creator to configure itself
     * @throws InstantiationException If reflection based creation fails
     * @throws IllegalAccessException If reflection based creation fails
     * @throws IllegalArgumentException If we have a duplicate name
     */
    void addCreator(String scriptName, String typeName, Map params) throws InstantiationException, IllegalAccessException, IllegalArgumentException;

    /**
     * Add a new creator.
     * TODO: If we refactor this, we should remove the scriptName parameter and
     * read the value from the creator
     * @param scriptName The name of the creator to Javascript
     * @param creator The creator to add
     * @throws IllegalArgumentException If we have a duplicate name
     */
    void addCreator(String scriptName, Creator creator) throws IllegalArgumentException;

    /**
     * Get a list of the javascript names of the allowed creators.
     * This method could be seen as a security risk because it could allow an
     * attacker to find out extra information about your system so it is only
     * available if debug is turned on.
     * @return Loop over all the known allowed classes
     * @throws SecurityException If we are not in debug mode
     */
    Collection getCreatorNames() throws SecurityException;

    /**
     * Find an Creator by name
     * @param scriptName The name of the creator to Javascript
     * @return The found Creator instance, or null if none was found.
     * @throws SecurityException If the Creator is not known
     */
    Creator getCreator(String scriptName) throws SecurityException;

    /**
     * Sets the creators for this creator manager.
     * @param creators the map of managed beans and their creator instances
     */
    void setCreators(Map creators);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy