1 /***
2 * Copyright 2007 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * For more information visit
11 * http://72miles.com and
12 * http://architecturerules.googlecode.com/svn/docs/index.html
13 */
14
15 package com.seventytwomiles.architecturerules.exceptions;
16
17
18 import java.util.Collection;
19
20
21 /***
22 * <p>Exception to be thrown when a configured source is not found and
23 * <samp><source not-found="exception"></samp></p>
24 *
25 * @author mikenereson
26 * @noinspection JavaDoc
27 * @see ArchitectureException
28 */
29 public class SourceNotFoundException extends ArchitectureException {
30
31
32 /***
33 * @see RuntimeException#RuntimeException()
34 */
35 public SourceNotFoundException() {
36 super("sources not found");
37 }
38
39
40 /***
41 * @see RuntimeException#RuntimeException(String)
42 */
43 public SourceNotFoundException(final String message) {
44 super(message);
45 }
46
47
48 /***
49 * @see RuntimeException#RuntimeException(Throwable)
50 */
51 public SourceNotFoundException(final Throwable cause) {
52 super("sources not found", cause);
53 }
54
55
56 /***
57 * <p>Instantiates a new SourceNotFoundException with a message containing
58 * all of the sources that were intteroagated.</p>
59 *
60 * @param sources
61 */
62 public SourceNotFoundException(final Collection sources) {
63
64
65
66
67 super("unable to find any source files in given source directories {0}"
68 .replaceAll("//{0}", sources.toString().replaceAll("////", "/"))
69 .replaceAll("//[", "")
70 .replaceAll("//]", ""));
71 }
72
73
74 /***
75 * @see RuntimeException#RuntimeException(String,Throwable)
76 */
77 public SourceNotFoundException(final String message,
78 final Throwable cause) {
79 super(message, cause);
80 }
81 }