1 package org.apache.continuum.distributed.transport.slave;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import com.atlassian.xmlrpc.Binder;
23 import com.atlassian.xmlrpc.BindingException;
24 import com.atlassian.xmlrpc.ConnectionInfo;
25 import org.apache.continuum.distributed.commons.utils.ContinuumXmlRpcBinder;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29 import java.net.URL;
30 import java.util.List;
31 import java.util.Map;
32 import java.util.Properties;
33 import java.util.TimeZone;
34
35
36
37
38 public class SlaveBuildAgentTransportClient
39 implements SlaveBuildAgentTransportService
40 {
41 private static final Logger log = LoggerFactory.getLogger( SlaveBuildAgentTransportClient.class );
42
43 private SlaveBuildAgentTransportService slave;
44
45 private String buildAgentUrl;
46
47 public SlaveBuildAgentTransportClient( URL serviceUrl )
48 throws Exception
49 {
50 this( serviceUrl, null, null );
51 }
52
53 public SlaveBuildAgentTransportClient( URL serviceUrl, String login, String password )
54 throws Exception
55 {
56 Binder binder = ContinuumXmlRpcBinder.getInstance();
57
58 ConnectionInfo connectionInfo = new ConnectionInfo();
59 connectionInfo.setUsername( login );
60 connectionInfo.setPassword( password );
61 connectionInfo.setTimeZone( TimeZone.getDefault() );
62
63 buildAgentUrl = serviceUrl.toString();
64
65 try
66 {
67 slave = binder.bind( SlaveBuildAgentTransportService.class, serviceUrl, connectionInfo );
68 }
69 catch ( BindingException e )
70 {
71 log.error( "Can't bind service interface " + SlaveBuildAgentTransportService.class.getName() + " to " +
72 serviceUrl.toExternalForm() + " using " + connectionInfo.getUsername() + ", " +
73 connectionInfo.getPassword(), e );
74 throw new Exception(
75 "Can't bind service interface " + SlaveBuildAgentTransportService.class.getName() + " to " +
76 serviceUrl.toExternalForm() + " using " + connectionInfo.getUsername() + ", " +
77 connectionInfo.getPassword(), e );
78 }
79 }
80
81 public Boolean buildProjects( List<Map<String, Object>> projectsBuildContext )
82 throws Exception
83 {
84 Boolean result;
85
86 try
87 {
88 result = slave.buildProjects( projectsBuildContext );
89 log.debug( "Building projects in build agent {}", buildAgentUrl );
90 }
91 catch ( Exception e )
92 {
93 log.error( "Failed to build projects in build agent " + buildAgentUrl, e );
94 throw new Exception( "Failed to build projects in build agent " + buildAgentUrl, e );
95 }
96
97 return result;
98 }
99
100 public List<Map<String, String>> getAvailableInstallations()
101 throws Exception
102 {
103 List<Map<String, String>> installations;
104
105 try
106 {
107 installations = slave.getAvailableInstallations();
108 log.debug( "Available installations in build agent {} : {}", buildAgentUrl, installations.size() );
109 }
110 catch ( Exception e )
111 {
112 log.error( "Failed to get available installations in build agent " + buildAgentUrl, e );
113 throw new Exception( "Failed to get available installations in build agent " + buildAgentUrl, e );
114 }
115
116 return installations;
117 }
118
119 public Map<String, Object> getBuildResult( int projectId )
120 throws Exception
121 {
122 Map<String, Object> buildResult;
123
124 try
125 {
126 buildResult = slave.getBuildResult( projectId );
127 log.debug( "Build result for project '{}' acquired from build agent {}", projectId, buildAgentUrl );
128 }
129 catch ( Exception e )
130 {
131 log.error( "Failed to get build result for project '" + projectId + "' in build agent " + buildAgentUrl,
132 e );
133 throw new Exception(
134 "Failed to get build result for project '" + projectId + "' in build agent " + buildAgentUrl, e );
135 }
136
137 return buildResult;
138 }
139
140 public Map<String, Object> getProjectCurrentlyBuilding()
141 throws Exception
142 {
143 Map<String, Object> map;
144
145 try
146 {
147 map = slave.getProjectCurrentlyBuilding();
148 log.debug( "Retrieving currently building project in build agent {}", buildAgentUrl );
149 }
150 catch ( Exception e )
151 {
152 log.error( "Failed to get the currently building project in build agent " + buildAgentUrl, e );
153 throw new Exception( "Failed to get the currently building project in build agent " + buildAgentUrl, e );
154 }
155
156 return map;
157 }
158
159 public Boolean ping()
160 throws Exception
161 {
162 Boolean result;
163
164 try
165 {
166 result = slave.ping();
167 log.debug( "Ping build agent {} : {}", buildAgentUrl, ( result ? "ok" : "failed" ) );
168 }
169 catch ( Exception e )
170 {
171 log.error( "Ping build agent " + buildAgentUrl + " error", e );
172 throw new Exception( "Ping build agent " + buildAgentUrl + " error", e );
173 }
174
175 return result;
176 }
177
178 public Boolean cancelBuild()
179 throws Exception
180 {
181 Boolean result;
182
183 try
184 {
185 result = slave.cancelBuild();
186 log.debug( "Cancelled current build in build agent {}", buildAgentUrl );
187 }
188 catch ( Exception e )
189 {
190 log.error( "Error cancelling current build in build agent " + buildAgentUrl, e );
191 throw new Exception( "Error cancelling current build in build agent " + buildAgentUrl, e );
192 }
193
194 return result;
195 }
196
197 public String generateWorkingCopyContent( int projectId, String directory, String baseUrl, String imagesBaseUrl )
198 throws Exception
199 {
200 String result;
201
202 try
203 {
204 result = slave.generateWorkingCopyContent( projectId, directory, baseUrl, imagesBaseUrl );
205 log.debug( "Generated working copy content for project '{}' in build agent ", projectId, buildAgentUrl );
206 }
207 catch ( Exception e )
208 {
209 log.error(
210 "Error generating working copy content for project '" + projectId + "' in build agent " + buildAgentUrl,
211 e );
212 throw new Exception(
213 "Error generating working copy content for project '" + projectId + "' in build agent " + buildAgentUrl,
214 e );
215 }
216
217 return result;
218 }
219
220 public Map<String, Object> getProjectFile( int projectId, String directory, String filename )
221 throws Exception
222 {
223 Map<String, Object> result;
224
225 try
226 {
227 result = slave.getProjectFile( projectId, directory, filename );
228 log.debug( "Retrieved project '{}' file content from build agent {}", projectId, buildAgentUrl );
229 }
230 catch ( Exception e )
231 {
232 log.error( "Error retrieving project '" + projectId + "' file content from build agent " + buildAgentUrl,
233 e );
234 throw new Exception(
235 "Error retrieving project '" + projectId + "' file content from build agent " + buildAgentUrl, e );
236 }
237
238 return result;
239 }
240
241 public Map getReleasePluginParameters( int projectId, String pomFilename )
242 throws Exception
243 {
244 Map result;
245
246 try
247 {
248 result = slave.getReleasePluginParameters( projectId, pomFilename );
249 log.debug( "Retrieving release plugin parameters for project '{}' from build agent {}", projectId,
250 buildAgentUrl );
251 }
252 catch ( Exception e )
253 {
254 log.error( "Error retrieving release plugin parameters for project '" + projectId + "' from build agent " +
255 buildAgentUrl, e );
256 throw new Exception(
257 "Error retrieving release plugin parameters for project '" + projectId + "' from build agent " +
258 buildAgentUrl, e );
259 }
260
261 return result;
262 }
263
264 public List<Map<String, String>> processProject( int projectId, String pomFilename, boolean autoVersionSubmodules )
265 throws Exception
266 {
267 List<Map<String, String>> result;
268
269 try
270 {
271 result = slave.processProject( projectId, pomFilename, autoVersionSubmodules );
272 log.debug( "Processing project '{}' in build agent ", projectId, buildAgentUrl );
273 }
274 catch ( Exception e )
275 {
276 log.error( "Error processing project '" + projectId + "' in build agent " + buildAgentUrl, e );
277 throw new Exception( "Error processing project '" + projectId + "' in build agent " + buildAgentUrl, e );
278 }
279
280 return result;
281 }
282
283 public String releasePrepare( Map project, Properties properties, Map releaseVersion, Map developmentVersion,
284 Map environments, String username )
285 throws Exception
286 {
287 String releaseId;
288
289 try
290 {
291 releaseId = slave.releasePrepare( project, properties, releaseVersion, developmentVersion, environments,
292 username );
293 log.debug( "Preparing release '{}' in build agent {}", releaseId, buildAgentUrl );
294 }
295 catch ( Exception e )
296 {
297 log.error( "Error while preparing release in build agent " + buildAgentUrl, e );
298 throw new Exception( "Error while preparing release in build agent " + buildAgentUrl, e );
299 }
300
301 return releaseId;
302 }
303
304 public Map<String, Object> getReleaseResult( String releaseId )
305 throws Exception
306 {
307 Map<String, Object> result;
308
309 try
310 {
311 result = slave.getReleaseResult( releaseId );
312 log.debug( "Retrieving release result, releaseId={} from build agent {}", releaseId, buildAgentUrl );
313 }
314 catch ( Exception e )
315 {
316 log.error( "Error retrieving release result, releaseId=" + releaseId + " from build agent " + buildAgentUrl,
317 e );
318 throw new Exception(
319 "Error retrieving release result, releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
320 }
321
322 return result;
323 }
324
325 public Map<String, Object> getListener( String releaseId )
326 throws Exception
327 {
328 Map<String, Object> result;
329
330 try
331 {
332 result = slave.getListener( releaseId );
333 log.debug( "Retrieving listener for releaseId={} from build agent {}", releaseId, buildAgentUrl );
334 }
335 catch ( Exception e )
336 {
337 log.error( "Error retrieving listener for releaseId=" + releaseId + " from build agent " + buildAgentUrl,
338 e );
339 throw new Exception(
340 "Error retrieving listener for releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
341 }
342
343 return result;
344 }
345
346 public Boolean removeListener( String releaseId )
347 throws Exception
348 {
349 Boolean result;
350
351 try
352 {
353 slave.removeListener( releaseId );
354 result = Boolean.FALSE;
355 log.debug( "Removing listener for releaseId={} from build agent {}", releaseId, buildAgentUrl );
356 }
357 catch ( Exception e )
358 {
359 log.error( "Error removing listener for releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
360 throw new Exception(
361 "Error removing listener for releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
362 }
363
364 return result;
365 }
366
367 public String getPreparedReleaseName( String releaseId )
368 throws Exception
369 {
370 String result;
371
372 try
373 {
374 result = slave.getPreparedReleaseName( releaseId );
375 log.debug( "Retrieving prepared release name, releaseId={} from build agent {}", releaseId, buildAgentUrl );
376 }
377 catch ( Exception e )
378 {
379 log.error( "Error while retrieving prepared release name, releaseId=" + releaseId + " from build agent " +
380 buildAgentUrl, e );
381 throw new Exception(
382 "Error while retrieving prepared release name, releaseId=" + releaseId + " from build agent " +
383 buildAgentUrl, e );
384 }
385
386 return result;
387 }
388
389 public Boolean releasePerform( String releaseId, String goals, String arguments, boolean useReleaseProfile,
390 Map repository, String username )
391 throws Exception
392 {
393 Boolean result;
394
395 try
396 {
397 slave.releasePerform( releaseId, goals, arguments, useReleaseProfile, repository, username );
398 result = Boolean.FALSE;
399 log.debug( "Performing release of releaseId={} from build agent {}", releaseId, buildAgentUrl );
400 }
401 catch ( Exception e )
402 {
403 log.error( "Error performing release of releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
404 throw new Exception(
405 "Error performing release of releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
406 }
407
408 return result;
409 }
410
411 public String releasePerformFromScm( String goals, String arguments, boolean useReleaseProfile, Map repository,
412 String scmUrl, String scmUsername, String scmPassword, String scmTag,
413 String scmTagBase, Map environments, String username )
414 throws Exception
415 {
416 String result;
417
418 try
419 {
420 result = slave.releasePerformFromScm( goals, arguments, useReleaseProfile, repository, scmUrl, scmUsername,
421 scmPassword, scmTag, scmTagBase, environments, username );
422 log.debug( "Performing release of scmUrl={} from build agent {}", scmUrl, buildAgentUrl );
423 }
424 catch ( Exception e )
425 {
426 log.error( "Error performing release from scm '" + scmUrl + "' from build agent " + buildAgentUrl, e );
427 throw new Exception( "Error performing release from scm '" + scmUrl + "' from build agent " + buildAgentUrl,
428 e );
429 }
430
431 return result;
432 }
433
434 public String releaseCleanup( String releaseId )
435 throws Exception
436 {
437 String result;
438
439 try
440 {
441 result = slave.releaseCleanup( releaseId );
442 log.debug( "Cleanup release, releaseId={} from build agent {}", releaseId, buildAgentUrl );
443 }
444 catch ( Exception e )
445 {
446 log.error( "Error cleaning up release, releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
447 throw new Exception(
448 "Error cleaning up release, releaseId=" + releaseId + " from build agent " + buildAgentUrl, e );
449 }
450
451 return result;
452 }
453
454 public Boolean releaseRollback( String releaseId, int projectId )
455 throws Exception
456 {
457 Boolean result;
458
459 try
460 {
461 slave.releaseRollback( releaseId, projectId );
462 result = Boolean.TRUE;
463 log.debug( "Rollback release. releaseId={}, projectId={} from build agent {}",
464 new Object[]{releaseId, projectId, buildAgentUrl} );
465 }
466 catch ( Exception e )
467 {
468 log.error( "Failed to rollback release. releaseId=" + releaseId + ", projectId=" + projectId +
469 " from build agent " + buildAgentUrl, e );
470 throw (Exception) e.getCause().getCause().getCause().getCause();
471 }
472
473 return result;
474 }
475
476 public Integer getBuildSizeOfAgent()
477 throws Exception
478 {
479 Integer size;
480
481 try
482 {
483 size = slave.getBuildSizeOfAgent();
484 log.debug( "Retrieving build size of build agent {}", buildAgentUrl );
485 }
486 catch ( Exception e )
487 {
488 log.error( "Failed to retrieve build size of build agent " + buildAgentUrl, e );
489 throw new Exception( "Failed to retrieve build size of build agent " + buildAgentUrl, e );
490 }
491
492 return size;
493 }
494
495 public Map<String, Object> getProjectCurrentlyPreparingBuild()
496 throws Exception
497 {
498 Map<String, Object> projects;
499
500 try
501 {
502 projects = slave.getProjectCurrentlyPreparingBuild();
503 log.debug( "Retrieving projects currently preparing build in build agent {}", buildAgentUrl );
504 }
505 catch ( Exception e )
506 {
507 log.error( "Failed to retrieve projects currently preparing build in build agent " + buildAgentUrl, e );
508 throw new Exception(
509 "Failed to retrieve projects currently preparing build in build agent " + buildAgentUrl, e );
510 }
511
512 return projects;
513 }
514
515 public List<Map<String, Object>> getProjectsAndBuildDefinitionsCurrentlyPreparingBuild()
516 throws Exception
517 {
518 List<Map<String, Object>> projects;
519
520 try
521 {
522 projects = slave.getProjectsAndBuildDefinitionsCurrentlyPreparingBuild();
523 log.debug( "Retrieving projects currently preparing build in build agent {}", buildAgentUrl );
524 }
525 catch ( Exception e )
526 {
527 log.error( "Failed to retrieve projects currently preparing build in build agent " + buildAgentUrl, e );
528 throw new Exception(
529 "Failed to retrieve projects currently preparing build in build agent " + buildAgentUrl, e );
530 }
531
532 return projects;
533 }
534
535 public List<Map<String, Object>> getProjectsInBuildQueue()
536 throws Exception
537 {
538 List<Map<String, Object>> projects;
539
540 try
541 {
542 projects = slave.getProjectsInBuildQueue();
543 log.debug( "Retrieving projects in build queue of build agent {}", buildAgentUrl );
544 }
545 catch ( Exception e )
546 {
547 log.error( "Failed to retrieve projects in build queue of build agent " + buildAgentUrl, e );
548 throw new Exception( "Failed to retrieve projects in build queue of build agent " + buildAgentUrl, e );
549 }
550
551 return projects;
552 }
553
554 public List<Map<String, Object>> getProjectsInPrepareBuildQueue()
555 throws Exception
556 {
557 List<Map<String, Object>> projects;
558
559 try
560 {
561 projects = slave.getProjectsInPrepareBuildQueue();
562 log.debug( "Retrieving projects in prepare build queue of build agent {}", buildAgentUrl );
563 }
564 catch ( Exception e )
565 {
566 log.error( "Failed to retrieve projects in prepare build queue of build agent " + buildAgentUrl, e );
567 throw new Exception( "Failed to retrieve projects in prepare build queue of build agent " + buildAgentUrl,
568 e );
569 }
570
571 return projects;
572 }
573
574 public List<Map<String, Object>> getProjectsAndBuildDefinitionsInPrepareBuildQueue()
575 throws Exception
576 {
577 List<Map<String, Object>> projects;
578
579 try
580 {
581 projects = slave.getProjectsAndBuildDefinitionsInPrepareBuildQueue();
582 log.debug( "Retrieving projects in prepare build queue of build agent {}", buildAgentUrl );
583 }
584 catch ( Exception e )
585 {
586 log.error( "Failed to retrieve projects in prepare build queue of build agent " + buildAgentUrl, e );
587 throw new Exception( "Failed to retrieve projects in prepare build queue of build agent " + buildAgentUrl,
588 e );
589 }
590
591 return projects;
592 }
593
594 public Boolean isProjectGroupInQueue( int projectGroupId )
595 throws Exception
596 {
597 Boolean result;
598
599 try
600 {
601 result = slave.isProjectGroupInQueue( projectGroupId );
602 log.debug( "Checking if project group '{}' is in queue in build agent {}", projectGroupId, buildAgentUrl );
603 }
604 catch ( Exception e )
605 {
606 log.error(
607 "Failed to check if project group '" + projectGroupId + "' is in queue in build agent " + buildAgentUrl,
608 e );
609 throw new Exception(
610 "Failed to check if project group '" + projectGroupId + "' is in queue in build agent " + buildAgentUrl,
611 e );
612 }
613
614 return result;
615 }
616
617 public Boolean isProjectScmRootInQueue( int projectScmRootId, List<Integer> projectIds )
618 throws Exception
619 {
620 Boolean result;
621
622 try
623 {
624 result = slave.isProjectScmRootInQueue( projectScmRootId, projectIds );
625 log.debug( "Checking if project scm root '{}' is in queue in build agent {}", projectScmRootId,
626 buildAgentUrl );
627 }
628 catch ( Exception e )
629 {
630 log.error( "Failed to check if project scm root '" + projectScmRootId + "' is in queue in build agent " +
631 buildAgentUrl, e );
632 throw new Exception(
633 "Failed to check if project scm root '" + projectScmRootId + "' is in queue in build agent " +
634 buildAgentUrl, e );
635 }
636
637 return result;
638 }
639
640 public Boolean isProjectCurrentlyBuilding( int projectId, int buildDefinitionId )
641 throws Exception
642 {
643 Boolean result;
644
645 try
646 {
647 result = slave.isProjectCurrentlyBuilding( projectId, buildDefinitionId );
648 log.debug( "Checking if projectId={}, buildDefinitionId={} is currently building in build agent {}",
649 new Object[]{projectId, buildDefinitionId, buildAgentUrl} );
650 }
651 catch ( Exception e )
652 {
653 log.error( "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
654 " is currently building in build agent " + buildAgentUrl, e );
655 throw new Exception(
656 "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
657 " is currently building in build agent " + buildAgentUrl, e );
658 }
659
660 return result;
661 }
662
663 public Boolean isProjectInBuildQueue( int projectId, int buildDefinitionId )
664 throws Exception
665 {
666 Boolean result;
667
668 try
669 {
670 result = slave.isProjectInBuildQueue( projectId, buildDefinitionId );
671 log.debug( "Checking if projectId={}, buildDefinitionId={} is in build queue of build agent {}",
672 new Object[]{projectId, buildDefinitionId, buildAgentUrl} );
673 }
674 catch ( Exception e )
675 {
676 log.error( "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
677 " is in build queue of build agent " + buildAgentUrl, e );
678 throw new Exception(
679 "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
680 " is in build queue of build agent " + buildAgentUrl, e );
681 }
682
683 return result;
684 }
685
686 public Boolean isProjectCurrentlyPreparingBuild( int projectId, int buildDefinitionId )
687 throws Exception
688 {
689 Boolean result;
690
691 try
692 {
693 result = slave.isProjectCurrentlyPreparingBuild( projectId, buildDefinitionId );
694 log.debug( "Checking if projectId={}, buildDefinitionId={} is currently preparing build in build agent {}",
695 new Object[]{projectId, buildDefinitionId, buildAgentUrl} );
696 }
697 catch ( Exception e )
698 {
699 log.error( "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
700 " is currently preparing build in build agent " + buildAgentUrl, e );
701 throw new Exception(
702 "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
703 " is currently preparing build in build agent " + buildAgentUrl, e );
704 }
705
706 return result;
707 }
708
709 public Boolean isProjectInPrepareBuildQueue( int projectId, int buildDefinitionId )
710 throws Exception
711 {
712 Boolean result;
713
714 try
715 {
716 result = slave.isProjectInPrepareBuildQueue( projectId, buildDefinitionId );
717 log.debug( "Checking if projectId={}, buildDefinitionId={} is in prepare build queue of build agent {}",
718 new Object[]{projectId, buildDefinitionId, buildAgentUrl} );
719 }
720 catch ( Exception e )
721 {
722 log.error( "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
723 " is in prepare build queue of build agent " + buildAgentUrl, e );
724 throw new Exception(
725 "Failed to check if projectId=" + projectId + ", buildDefinitionId=" + buildDefinitionId +
726 " is in prepare build queue of build agent " + buildAgentUrl, e );
727 }
728
729 return result;
730 }
731
732 public Boolean isProjectGroupInPrepareBuildQueue( int projectGroupId )
733 throws Exception
734 {
735 Boolean result;
736
737 try
738 {
739 result = slave.isProjectGroupInPrepareBuildQueue( projectGroupId );
740 log.debug( "Checking if projectGroup {} is in prepare build queue of build agent {}", projectGroupId,
741 buildAgentUrl );
742 }
743 catch ( Exception e )
744 {
745 log.error(
746 "Failed to check if projectGroup " + projectGroupId + " is in prepare build queue of build agent " +
747 buildAgentUrl, e );
748 throw new Exception(
749 "Failed to check if projectGroup " + projectGroupId + " is in prepare build queue of build agent " +
750 buildAgentUrl, e );
751 }
752
753 return result;
754 }
755
756 public Boolean isProjectGroupCurrentlyPreparingBuild( int projectGroupId )
757 throws Exception
758 {
759 Boolean result;
760
761 try
762 {
763 result = slave.isProjectGroupCurrentlyPreparingBuild( projectGroupId );
764 log.debug( "Checking if projectGroup {} is currently preparing build in build agent {}", projectGroupId,
765 buildAgentUrl );
766 }
767 catch ( Exception e )
768 {
769 log.error(
770 "Failed to check if projectGroup " + projectGroupId + " is currently preparing build in build agent " +
771 buildAgentUrl, e );
772 throw new Exception(
773 "Failed to check if projectGroup " + projectGroupId + " is currently preparing build in build agent " +
774 buildAgentUrl, e );
775 }
776
777 return result;
778 }
779
780 public Boolean removeFromPrepareBuildQueue( int projectGroupId, int scmRootId )
781 throws Exception
782 {
783 Boolean result;
784
785 try
786 {
787 result = slave.removeFromPrepareBuildQueue( projectGroupId, scmRootId );
788 log.debug( "Remove projects from prepare build queue of build agent {}. projectGroupId={}, scmRootId={}",
789 new Object[]{buildAgentUrl, projectGroupId, scmRootId} );
790 }
791 catch ( Exception e )
792 {
793 log.error( "Failed to remove projects from prepare build queue of build agent " + buildAgentUrl +
794 ". projectGroupId=" + projectGroupId +
795 ", scmRootId=" + scmRootId, e );
796 throw new Exception(
797 "Failed to remove from prepare build queue of build agent " + buildAgentUrl + ". projectGroupId=" +
798 projectGroupId +
799 " scmRootId=" + scmRootId, e );
800 }
801
802 return result;
803 }
804
805 public Boolean removeFromPrepareBuildQueue( List<String> hashCodes )
806 throws Exception
807 {
808 Boolean result;
809
810 try
811 {
812 result = slave.removeFromPrepareBuildQueue( hashCodes );
813 log.debug( "Removing projects from prepare build queue of build agent {}", buildAgentUrl );
814 }
815 catch ( Exception e )
816 {
817 log.error( "Failed to remove projects from prepare build queue of build agent " + buildAgentUrl, e );
818 throw new Exception( "Failed to remove projects from prepare build queue of build agent " + buildAgentUrl,
819 e );
820 }
821
822 return result;
823 }
824
825 public Boolean removeFromBuildQueue( int projectId, int buildDefinitionId )
826 throws Exception
827 {
828 Boolean result;
829
830 try
831 {
832 result = slave.removeFromBuildQueue( projectId, buildDefinitionId );
833 log.debug( "Removing project '{}' from build queue of build agent {}", projectId, buildAgentUrl );
834 }
835 catch ( Exception e )
836 {
837 log.error( "Failed to remove project '" + projectId + "' from build queue of build agent " + buildAgentUrl,
838 e );
839 throw new Exception(
840 "Failed to remove project '" + projectId + "' from build queue of build agent " + buildAgentUrl, e );
841 }
842
843 return result;
844 }
845
846 public Boolean removeFromBuildQueue( List<String> hashCodes )
847 throws Exception
848 {
849 Boolean result;
850
851 try
852 {
853 result = slave.removeFromBuildQueue( hashCodes );
854 log.debug( "Removing projects from build queue of build agent {}", buildAgentUrl );
855 }
856 catch ( Exception e )
857 {
858 log.error( "Failed to remove projects from build queue of build agent " + buildAgentUrl, e );
859 throw new Exception( "Failed to remove projects from build queue of build agent " + buildAgentUrl, e );
860 }
861
862 return result;
863 }
864
865 public String getBuildAgentPlatform()
866 throws Exception
867 {
868 String result;
869
870 try
871 {
872 result = slave.getBuildAgentPlatform();
873 log.debug( "Retrieved build agent {} platform", buildAgentUrl );
874 }
875 catch ( Exception e )
876 {
877 log.error( "Failed to return build agent " + buildAgentUrl + " platform", e );
878 throw new Exception( "Failed to return build agent " + buildAgentUrl + " platform", e );
879 }
880
881 return result;
882 }
883
884 public void executeDirectoryPurge( String directoryType, int daysOlder, int retentionCount, boolean deleteAll )
885 throws Exception
886 {
887 slave.executeDirectoryPurge( directoryType, daysOlder, retentionCount, deleteAll );
888 }
889 }