|
21 | 21 | import java.io.OutputStream;
|
22 | 22 | import java.nio.file.Files;
|
23 | 23 | import java.util.List;
|
| 24 | +import java.util.Map; |
| 25 | +import java.util.concurrent.ConcurrentHashMap; |
24 | 26 |
|
25 | 27 | import org.codehaus.plexus.util.DirectoryScanner;
|
26 | 28 | import org.codehaus.plexus.util.Scanner;
|
27 | 29 | import org.slf4j.Logger;
|
28 | 30 | import org.slf4j.LoggerFactory;
|
29 | 31 |
|
30 | 32 | /**
|
31 |
| - * Filesystem based non-incremental build context implementation which behaves as if all files |
32 |
| - * were just created. More specifically, |
| 33 | + * Filesystem based non-incremental build context implementation which behaves |
| 34 | + * as if all files were just created. More specifically, |
33 | 35 | *
|
34 |
| - * hasDelta returns <code>true</code> for all paths |
35 |
| - * newScanner returns Scanner that scans all files under provided basedir |
36 |
| - * newDeletedScanner always returns empty scanner. |
37 |
| - * isIncremental returns false |
38 |
| - * getValue always returns null |
| 36 | + * <ol> |
| 37 | + * <li>hasDelta returns <code>true</code> for all paths</li> |
| 38 | + * <li>newScanner returns Scanner that scans all files under provided |
| 39 | + * basedir</li> |
| 40 | + * <li>newDeletedScanner always returns empty scanner</li> |
| 41 | + * <li>isIncremental returns <code>false</code></li> |
| 42 | + * <li>getValue always returns the last set value in this session and only |
| 43 | + * stores to memory</li> |
| 44 | + * </ol> |
39 | 45 | */
|
40 | 46 | @Named("default")
|
41 | 47 | @Singleton
|
42 | 48 | public class DefaultBuildContext implements BuildContext {
|
43 | 49 |
|
| 50 | + private final Map<String, Object> contextMap = new ConcurrentHashMap<>(); |
44 | 51 | private final Logger logger = LoggerFactory.getLogger(DefaultBuildContext.class);
|
45 | 52 | /** {@inheritDoc} */
|
46 | 53 | public boolean hasDelta(String relpath) {
|
@@ -105,11 +112,12 @@ public boolean isIncremental() {
|
105 | 112 |
|
106 | 113 | /** {@inheritDoc} */
|
107 | 114 | public Object getValue(String key) {
|
108 |
| - return null; |
| 115 | + return contextMap.get(key); |
109 | 116 | }
|
110 | 117 |
|
111 | 118 | /** {@inheritDoc} */
|
112 | 119 | public void setValue(String key, Object value) {
|
| 120 | + contextMap.put(key, value); |
113 | 121 | }
|
114 | 122 |
|
115 | 123 | private String getMessage(File file, int line, int column, String message) {
|
|
0 commit comments