Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f1c12d7

Browse filesBrowse files
author
Christoph Läubrich
committed
Store Objects in the DefaultContext in a map
Fix #48
1 parent f28ab02 commit f1c12d7
Copy full SHA for f1c12d7

File tree

Expand file treeCollapse file tree

1 file changed

+16
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-8
lines changed

‎src/main/java/org/codehaus/plexus/build/DefaultBuildContext.java

Copy file name to clipboardExpand all lines: src/main/java/org/codehaus/plexus/build/DefaultBuildContext.java
+16-8Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,33 @@
2121
import java.io.OutputStream;
2222
import java.nio.file.Files;
2323
import java.util.List;
24+
import java.util.Map;
25+
import java.util.concurrent.ConcurrentHashMap;
2426

2527
import org.codehaus.plexus.util.DirectoryScanner;
2628
import org.codehaus.plexus.util.Scanner;
2729
import org.slf4j.Logger;
2830
import org.slf4j.LoggerFactory;
2931

3032
/**
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,
3335
*
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>
3945
*/
4046
@Named("default")
4147
@Singleton
4248
public class DefaultBuildContext implements BuildContext {
4349

50+
private final Map<String, Object> contextMap = new ConcurrentHashMap<>();
4451
private final Logger logger = LoggerFactory.getLogger(DefaultBuildContext.class);
4552
/** {@inheritDoc} */
4653
public boolean hasDelta(String relpath) {
@@ -105,11 +112,12 @@ public boolean isIncremental() {
105112

106113
/** {@inheritDoc} */
107114
public Object getValue(String key) {
108-
return null;
115+
return contextMap.get(key);
109116
}
110117

111118
/** {@inheritDoc} */
112119
public void setValue(String key, Object value) {
120+
contextMap.put(key, value);
113121
}
114122

115123
private String getMessage(File file, int line, int column, String message) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.