Skip to content

Commit

Permalink
feat(registration): receive platform env map from server on registrat…
Browse files Browse the repository at this point in the history
…ion (#143)
  • Loading branch information
andrewazores authored Nov 9, 2023
1 parent e02ba92 commit c388862
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/main/java/io/cryostat/agent/model/PluginInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,28 @@
*/
package io.cryostat.agent.model;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class PluginInfo {

private String id;
private String token;
private Map<String, String> env = new HashMap<>();

public PluginInfo() {}

public PluginInfo(String id, String token) {
public PluginInfo(String id, String token, Map<String, String> env) {
this.id = id;
this.token = token;
this.env.putAll(env);
}

public void copyFrom(PluginInfo o) {
setId(o.getId());
setToken(o.getToken());
setEnv(o.getEnv());
}

public void clear() {
Expand All @@ -50,6 +55,10 @@ public String getToken() {
return token;
}

public Map<String, String> getEnv() {
return new HashMap<>(env);
}

public void setId(String id) {
this.id = id;
}
Expand All @@ -58,9 +67,14 @@ public void setToken(String token) {
this.token = token;
}

public void setEnv(Map<String, String> env) {
this.env.clear();
this.env.putAll(env);
}

@Override
public int hashCode() {
return Objects.hash(id, token);
return Objects.hash(id, token, env);
}

@Override
Expand All @@ -75,6 +89,8 @@ public boolean equals(Object obj) {
return false;
}
PluginInfo other = (PluginInfo) obj;
return Objects.equals(id, other.id) && Objects.equals(token, other.token);
return Objects.equals(id, other.id)
&& Objects.equals(token, other.token)
&& Objects.equals(env, other.env);
}
}

0 comments on commit c388862

Please sign in to comment.