001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     * 
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    package org.apache.commons.launcher;
019    
020    import org.apache.tools.ant.BuildException;
021    
022    /**
023     * An interface that provides a means for application developers to perform
024     * dynamic configuration and error checking of the attributes and nested
025     * elements associated with a "launch" task that connot be easily done within 
026     * the constraints of Ant.
027     * <p>
028     * An implementor of this interface can be attached to a "launch" task by
029     * setting the following "launch" task attributes in the Launcher's XML
030     * file:
031     * <ul>
032     * <li><code>filterclassname</code> - The name of the class that implements
033     * this interface
034     * <li><code>filterclasspath</code> - (Optional) The classpath for the class
035     * that implements
036     * </ul>
037     *
038     * @author Patrick Luby
039     */
040    public interface LaunchFilter {
041    
042        //----------------------------------------------------------------- Methods
043    
044        /**
045         * Perform error checking and editing of the JVM command line arguments
046         * that an instance of the {@link LaunchTask} class has constructed.
047         * Implementors will receive an instance of the {@link LaunchCommand} from
048         * the {@link LaunchTask} instance that invokes this method. The
049         * implementor of this method can then retrieve and edit any of the
050         * JVM command line arguments via the {@link LaunchCommand} class' public
051         * methods.
052         *
053         * @param launchCommand a configured {@link LaunchCommand} instance
054         * @throws BuildException if any errors occur
055         */
056        public void filter(LaunchCommand launchCommand) throws BuildException;
057    
058    }