001    // Copyright 2007 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.annotations.panorama;
016    
017    import java.util.List;
018    
019    import org.apache.examples.panorama.mail.MailStartup;
020    import org.apache.examples.panorama.startup.Executable;
021    import org.apache.examples.panorama.startup.impl.Task;
022    import org.apache.hivemind.annotations.AbstractAnnotatedModule;
023    import org.apache.hivemind.annotations.definition.Contribution;
024    import org.apache.hivemind.annotations.definition.Service;
025    
026    public class PanoramaMailModule extends AbstractAnnotatedModule
027    {
028        @Service( id="MailStartup" )
029        public Executable getMailStartupService()
030        {
031            Executable startup = new MailStartup();
032            return startup;
033        }
034        
035        @Contribution( configurationId="panorama.startup.tasks" )
036        public void contributeTaks(List<Task> tasks)
037        {
038            Task mailStartupTask = new Task();
039            mailStartupTask.setExecutable(service("MailStartup", Executable.class));
040            mailStartupTask.setId("mail");
041            mailStartupTask.setTitle("Mail");
042            
043            tasks.add(mailStartupTask);
044        }
045    
046    }