1 package org.apache.maven.continuum.execution.manager;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.continuum.ContinuumException;
23 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
24 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28 import java.util.HashMap;
29 import java.util.Map;
30
31
32
33
34
35
36
37 public class DefaultBuildExecutorManager
38 implements BuildExecutorManager, Initializable
39 {
40 private static final Logger log = LoggerFactory.getLogger( DefaultBuildExecutorManager.class );
41
42
43
44
45 private Map<String, ContinuumBuildExecutor> executors;
46
47
48
49
50
51 public void initialize()
52 {
53 if ( executors == null )
54 {
55 executors = new HashMap<String, ContinuumBuildExecutor>();
56 }
57
58 if ( executors.size() == 0 )
59 {
60 log.warn( "No build executors defined." );
61 }
62 else
63 {
64 log.info( "Build executors:" );
65
66 for ( String key : executors.keySet() )
67 {
68 log.info( " " + key );
69 }
70 }
71 }
72
73
74
75
76
77 public ContinuumBuildExecutor getBuildExecutor( String builderType )
78 throws ContinuumException
79 {
80 ContinuumBuildExecutor executor = executors.get( builderType );
81
82 if ( executor == null )
83 {
84 throw new ContinuumException( "No such executor: '" + builderType + "'." );
85 }
86
87 return executor;
88 }
89
90 public boolean hasBuildExecutor( String executorId )
91 {
92 return executors.containsKey( executorId );
93 }
94 }