-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>io.monocycle</groupId> | ||
<artifactId>monocycle-java-api</artifactId> | ||
<version>0.1.0-SNAPSHOT</version> | ||
<name>Monocycle Java Agent API</name> | ||
|
||
<properties> | ||
<java.version>1.6</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.3.3</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.monocycle.agent.api; | ||
|
||
import java.io.Serializable; | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
|
||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") | ||
@JsonSubTypes({ @JsonSubTypes.Type(value = DoubleDataHolder.class, name = "double"), @JsonSubTypes.Type(value = LongDataHolder.class, name = "long"), | ||
@JsonSubTypes.Type(value = StringDataHolder.class, name = "string") }) | ||
public interface DataHolder { | ||
|
||
Serializable getValue(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package io.monocycle.agent.api; | ||
|
||
import java.util.Collection; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
||
/** | ||
* POJO to represent a single DataPoint | ||
*/ | ||
public class DataPoint { | ||
|
||
private String metric; | ||
|
||
private Map<String, DataHolder> valuesMap; | ||
|
||
public DataPoint() { | ||
valuesMap = new LinkedHashMap<String, DataHolder>(); | ||
} | ||
|
||
public DataPoint(String metric) { | ||
this(); | ||
this.metric = metric; | ||
} | ||
|
||
@JsonIgnore | ||
public Collection<String> getKeys() { | ||
return getValuesMap().keySet(); | ||
} | ||
|
||
@JsonIgnore | ||
public Collection<DataHolder> getValues() { | ||
return getValuesMap().values(); | ||
} | ||
|
||
public void addValue(String key, DataHolder value) { | ||
valuesMap.put(key, value); | ||
} | ||
|
||
public String getMetric() { | ||
return metric; | ||
} | ||
|
||
public void setMetric(String metric) { | ||
this.metric = metric.toLowerCase(); | ||
} | ||
|
||
public Map<String, DataHolder> getValuesMap() { | ||
return valuesMap; | ||
} | ||
|
||
public void setValuesMap(Map<String, DataHolder> valuesMap) { | ||
this.valuesMap = valuesMap; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " {\n\tmetric: " + metric + "\n\tvaluesMap: " + valuesMap + "\n}"; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/io/monocycle/agent/api/DoubleDataHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.monocycle.agent.api; | ||
|
||
public class DoubleDataHolder implements DataHolder { | ||
|
||
private Double value; | ||
|
||
public DoubleDataHolder() { | ||
// Default Constructor | ||
} | ||
|
||
public DoubleDataHolder(Double value) { | ||
this.value = value; | ||
} | ||
|
||
public Double getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " {\n\tvalue: " + value + "\n}"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.monocycle.agent.api; | ||
|
||
public class LongDataHolder implements DataHolder { | ||
|
||
private Long value; | ||
|
||
public LongDataHolder() { | ||
// Default constructor | ||
} | ||
|
||
public LongDataHolder(Long value) { | ||
this.value = value; | ||
} | ||
|
||
public Long getValue() { | ||
return value; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.monocycle.agent.api; | ||
|
||
/** | ||
* Server | ||
*/ | ||
public class Server { | ||
|
||
private String hostname; | ||
|
||
private String description; | ||
|
||
private ServerSummary serverSummary; | ||
|
||
public String getHostname() { | ||
return hostname; | ||
} | ||
|
||
public void setHostname(String hostname) { | ||
this.hostname = hostname; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public ServerSummary getServerSummary() { | ||
return serverSummary; | ||
} | ||
|
||
public void setServerSummary(ServerSummary serverSummary) { | ||
this.serverSummary = serverSummary; | ||
} | ||
|
||
} |
103 changes: 103 additions & 0 deletions
103
src/main/java/io/monocycle/agent/api/ServerSummary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
package io.monocycle.agent.api; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* ServerSummary | ||
*/ | ||
public class ServerSummary { | ||
|
||
private Integer coreCount; | ||
|
||
private Long totalMemory; | ||
|
||
private Long totalSwap; | ||
|
||
private String vendorName; | ||
|
||
private String vendorDescription; | ||
|
||
public Set<MountPointSummary> mountPoints; | ||
|
||
public Integer getCoreCount() { | ||
return coreCount; | ||
} | ||
|
||
public void setCoreCount(Integer coreCount) { | ||
this.coreCount = coreCount; | ||
} | ||
|
||
public Long getTotalMemory() { | ||
return totalMemory; | ||
} | ||
|
||
public void setTotalMemory(Long totalMemory) { | ||
this.totalMemory = totalMemory; | ||
} | ||
|
||
public Long getTotalSwap() { | ||
return totalSwap; | ||
} | ||
|
||
public void setTotalSwap(Long totalSwap) { | ||
this.totalSwap = totalSwap; | ||
} | ||
|
||
public String getVendorName() { | ||
return vendorName; | ||
} | ||
|
||
public void setVendorName(String vendorName) { | ||
this.vendorName = vendorName; | ||
} | ||
|
||
public String getVendorDescription() { | ||
return vendorDescription; | ||
} | ||
|
||
public void setVendorDescription(String vendorDescription) { | ||
this.vendorDescription = vendorDescription; | ||
} | ||
|
||
public Set<MountPointSummary> getMountPoints() { | ||
return mountPoints; | ||
} | ||
|
||
public void setMountPoints(Set<MountPointSummary> mountPoints) { | ||
this.mountPoints = mountPoints; | ||
} | ||
|
||
public static class MountPointSummary { | ||
|
||
private String device; | ||
|
||
private String mountPoint; | ||
|
||
public MountPointSummary() { | ||
// Default Constructor | ||
} | ||
|
||
public MountPointSummary(String device, String mountPoint) { | ||
this.device = device; | ||
this.mountPoint = mountPoint; | ||
} | ||
|
||
public String getDevice() { | ||
return device; | ||
} | ||
|
||
public void setDevice(String device) { | ||
this.device = device; | ||
} | ||
|
||
public String getMountPoint() { | ||
return mountPoint; | ||
} | ||
|
||
public void setMountPoint(String mountPoint) { | ||
this.mountPoint = mountPoint; | ||
} | ||
|
||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/io/monocycle/agent/api/StringDataHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.monocycle.agent.api; | ||
|
||
public class StringDataHolder implements DataHolder { | ||
|
||
private String value; | ||
|
||
public StringDataHolder() { | ||
// Default Constructor | ||
} | ||
|
||
public StringDataHolder(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return getClass().getName() + " {\n\tvalue: " + value + "\n}"; | ||
} | ||
|
||
} |