001    // Copyright 2004, 2005 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.examples.panorama.startup.impl;
016    
017    import org.apache.hivemind.impl.BaseLocatable;
018    
019    import org.apache.examples.panorama.startup.Executable;
020    
021    /**
022     * An operation that may be executed. A Task exists to wrap an
023     * {@link org.apache.examples.panorama.startup.Executable} object with a title and ordering information (id, after,
024     * before).
025     * 
026     * @author Howard Lewis Ship
027     */
028    public class Task extends BaseLocatable implements Executable
029    {
030        private String _id;
031    
032        private String _title;
033    
034        private String _after;
035    
036        private String _before;
037    
038        private Executable _executable;
039    
040        public String getBefore()
041        {
042            return _before;
043        }
044    
045        public String getId()
046        {
047            return _id;
048        }
049    
050        public String getAfter()
051        {
052            return _after;
053        }
054    
055        public String getTitle()
056        {
057            return _title;
058        }
059    
060        public void setExecutable(Executable executable)
061        {
062            _executable = executable;
063        }
064    
065        public void setBefore(String string)
066        {
067            _before = string;
068        }
069    
070        public void setId(String string)
071        {
072            _id = string;
073        }
074    
075        public void setAfter(String string)
076        {
077            _after = string;
078        }
079    
080        public void setTitle(String string)
081        {
082            _title = string;
083        }
084    
085        /**
086         * Delegates to the {@link #setExecutable(Executable) executable} object.
087         */
088        public void execute() throws Exception
089        {
090            _executable.execute();
091        }
092    
093    }