1 /*
2 Copyright (c) 2025 Christoph Läubrich All rights reserved.
3
4 This program is licensed to you under the Apache License Version 2.0,
5 and you may not use this file except in compliance with the Apache License Version 2.0.
6 You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
7
8 Unless required by applicable law or agreed to in writing,
9 software distributed under the Apache License Version 2.0 is distributed on an
10 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
12 */
13 package org.codehaus.plexus.build.connect.messages;
14
15 import java.io.File;
16 import java.nio.file.Path;
17 import java.util.Collections;
18 import java.util.Map;
19
20 /**
21 * A message that indicates a path should be refreshed (e.g. because new files
22 * are placed in a generated folder)
23 */
24 public class RefreshMessage extends Message {
25
26 private static final String PATH_KEY = "path";
27
28 /**
29 * Create a new message to refresh a path
30 *
31 * @param path the path to refresh
32 */
33 public RefreshMessage(Path path) {
34 super(Collections.singletonMap(PATH_KEY, path.toFile().getAbsolutePath()));
35 }
36
37 /**
38 * @return the path to refresh
39 */
40 public Path getPath() {
41 return new File(getProperty(PATH_KEY)).toPath();
42 }
43
44 RefreshMessage(String sessionId, long threadId, Map<String, String> payload) {
45 super(sessionId, threadId, payload);
46 }
47 }