1 package org.apache.continuum.distributed.transport.master;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Map;
23
24 import org.apache.continuum.builder.distributed.DistributedBuildService;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28
29
30
31 public class MasterBuildAgentTransportServer
32 implements MasterBuildAgentTransportService
33 {
34 private static final Logger log = LoggerFactory.getLogger( MasterBuildAgentTransportServer.class );
35
36 private final DistributedBuildService distributedBuildService;
37
38 public MasterBuildAgentTransportServer( DistributedBuildService distributedBuildService )
39 {
40 this.distributedBuildService = distributedBuildService;
41 }
42
43 public Boolean returnBuildResult( Map<String, Object> buildResult )
44 throws Exception
45 {
46 log.info( "Build result returned." );
47 distributedBuildService.updateBuildResult( buildResult );
48 return Boolean.TRUE;
49 }
50
51 public Boolean ping()
52 throws Exception
53 {
54 log.info( "Ping ok" );
55
56 return Boolean.TRUE;
57 }
58
59 public Boolean prepareBuildFinished( Map<String, Object> prepareBuildResult )
60 throws Exception
61 {
62 log.info( "Prepare build finished." );
63 distributedBuildService.prepareBuildFinished( prepareBuildResult );
64 return Boolean.TRUE;
65 }
66
67 public Boolean startProjectBuild( Integer projectId )
68 throws Exception
69 {
70 log.info( "Start project build." );
71 distributedBuildService.startProjectBuild( projectId );
72 return Boolean.TRUE;
73 }
74
75 public Boolean startPrepareBuild( Map<String, Object> prepareBuildResult )
76 throws Exception
77 {
78 log.info( "Start prepare build." );
79 distributedBuildService.startPrepareBuild( prepareBuildResult );
80 return Boolean.TRUE;
81 }
82
83 public Map<String, String> getEnvironments( Integer buildDefinitionId, String installationType )
84 throws Exception
85 {
86 log.info( "Retrieving environments" );
87 return distributedBuildService.getEnvironments( buildDefinitionId, installationType );
88 }
89
90 public Boolean updateProject( Map<String, Object> project )
91 throws Exception
92 {
93 log.info( "Start updating project" );
94 distributedBuildService.updateProject( project );
95 return Boolean.TRUE;
96 }
97
98 public Boolean shouldBuild( Map<String, Object> context )
99 throws Exception
100 {
101 log.info( "Checking if project should build" );
102 return distributedBuildService.shouldBuild( context );
103 }
104 }