001 package org.apache.maven.lifecycle;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements. See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership. The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License. You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied. See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022 import org.apache.maven.plugin.MojoExecution;
023
024 import java.util.List;
025
026 /**
027 * Class Scheduling.
028 *
029 * @since 3.0
030 */
031 public class Scheduling
032 {
033 private String lifecycle;
034
035 private List<Schedule> schedules;
036
037 public Scheduling()
038 {
039 }
040
041 public Scheduling( String lifecycle, List<Schedule> schedules )
042 {
043 this.lifecycle = lifecycle;
044 this.schedules = schedules;
045 }
046
047 public String getLifecycle()
048 {
049 return lifecycle;
050 }
051
052 public void setLifecycle( String lifecycle )
053 {
054 this.lifecycle = lifecycle;
055 }
056
057 public List<Schedule> getSchedules()
058 {
059 return schedules;
060 }
061
062
063 public Schedule getSchedule( String phaseName )
064 {
065 if ( phaseName != null )
066 {
067 for ( Schedule schedule : schedules )
068 {
069 if ( phaseName.equals( schedule.getPhase() ) )
070 {
071 return schedule;
072 }
073 }
074 }
075
076 return null;
077 }
078
079 public Schedule getSchedule( MojoExecution mojoExecution )
080 {
081 if ( mojoExecution != null )
082 {
083 for ( Schedule schedule : schedules )
084 {
085 if ( schedule.appliesTo( mojoExecution ) )
086 {
087 return schedule;
088 }
089 }
090 }
091
092 return null;
093 }
094
095 public void setSchedules( List<Schedule> schedules )
096 {
097 this.schedules = schedules;
098 }
099 }