Skip to content

Commit

Permalink
Knowledge Synchronization and Admin REST (#18)
Browse files Browse the repository at this point in the history
* Updates on the Planning related to Knowledge Synchronization
* Knowledge up to date.

* TMA-Admin-Rest first release

* TMA-Utils update:
-adding resourceId to Score interface
-adding executeBatch to DatabaseManager

* New JMX Probe to monitor Java AppServer apps.
  • Loading branch information
joseadp authored and nmsa committed Oct 18, 2019
1 parent 3faa7d6 commit 26af094
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 37 deletions.
Binary file modified architecture/TMA-Framework.asta
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package eubr.atmosphere.tma.data;

public class MetricData {

private int metricId;
private long valueTime;

public int getMetricId() {
return metricId;
}
public void setMetricId(int metricId) {
this.metricId = metricId;
}

public long getValueTime() {
return valueTime;
}

public void setValueTime(long valueTime) {
this.valueTime = valueTime;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public static STATUS valueOf(int ordinal) {

private Integer planId;
private int metricId;
private int qualityModelId;
private long valueTime;
private STATUS status; // TODO: define the possible status in a enum
private List<ActionPlan> actionList;
Expand All @@ -51,14 +50,6 @@ public void setMetricId(int metricId) {
this.metricId = metricId;
}

public int getQualityModelId() {
return qualityModelId;
}

public void setQualityModelId(int qualityModelId) {
this.qualityModelId = qualityModelId;
}

public STATUS getStatus() {
return status;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,29 @@ public static ResultSet executeQuery(PreparedStatement ps) {
return rs;
}

public int execute(PreparedStatement ps) {
int key = -1;
try {
ps.execute();
ResultSet generatedKeys = ps.getGeneratedKeys();
if (generatedKeys.next()) {
key = generatedKeys.getInt(1);
}
} catch (SQLException e) {
LOGGER.error(e.getMessage());
}
return key;
}

public int[] executeBatch(PreparedStatement ps) {
try {
return ps.executeBatch();
} catch (SQLException e) {
LOGGER.error(e.getMessage());
}
return null;
}

public void close() {
try {
if (resultSet != null) {
Expand All @@ -95,18 +118,4 @@ public void close() {
LOGGER.error(e.getMessage());
}
}

public int execute(PreparedStatement ps) {
int key = -1;
try {
ps.execute();
ResultSet generatedKeys = ps.getGeneratedKeys();
if (generatedKeys.next()) {
key = generatedKeys.getInt(1);
}
} catch (SQLException e) {
LOGGER.error(e.getMessage());
}
return key;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class PerformanceScore implements Score {
private Double responseTime;
private Double demand;
private Double rateRequestUnderContracted;
private int metricId;
private int resourceId;
private long valueTime;

public PerformanceScore() {
super();
Expand Down Expand Up @@ -86,4 +89,31 @@ public Double getScore() {

return this.score;
}

@Override
public long getValueTime() {
return this.valueTime;
}

public void setValueTime(long valueTime) {
this.valueTime = valueTime;
}

@Override
public int getResourceId() {
return this.resourceId;
}

public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}

@Override
public int getMetricId() {
return this.metricId;
}

public void setMetricId(int metricId) {
this.metricId = metricId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public ResourceConsumptionScore() {
private Double cpuNode;
private Double memoryNode;
private Double score;
private int metricId;
private int resourceId;
private long valueTime;

public Double getCpuPod() {
return cpuPod;
Expand Down Expand Up @@ -79,4 +82,31 @@ public boolean isValid() {
return this.getCpuNode()!= null && this.getCpuPod()!= null &&
this.getMemoryNode()!= null && this.getMemoryPod()!= null;
}

@Override
public long getValueTime() {
return this.valueTime;
}

public void setValueTime(long valueTime) {
this.valueTime = valueTime;
}

@Override
public int getResourceId() {
return this.resourceId;
}

public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}

@Override
public int getMetricId() {
return this.metricId;
}

public void setMetricId(int metricId) {
this.metricId = metricId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@
public interface Score {

public Double getScore();

public long getValueTime();

public int getResourceId();

public int getMetricId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ public class TrustworthinessScore implements Score {
private ResourceConsumptionScore resourceConsumptionScore;
private PerformanceScore performanceScore;
private Integer podCount;
private long timestamp;
private int metricId;
private int resourceId;
private long valueTime;

public TrustworthinessScore(ResourceConsumptionScore resourceConsumptionPodScore,
PerformanceScore performanceScore) {
Expand All @@ -23,7 +25,7 @@ public String toString() {
+ ", resourceConsumptionScore=" + resourceConsumptionScore
+ ", performanceScore=" + performanceScore
+ ", podCount=" + podCount
+ ", timestamp=" + timestamp
+ ", valueTime=" + valueTime
+ "]";
}

Expand Down Expand Up @@ -51,19 +53,38 @@ public void setPodCount(Integer podCount) {
this.podCount = podCount;
}

public long getTimestamp() {
return timestamp;
}

public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}

public ResourceConsumptionScore getResourceConsumptionScore() {
return this.resourceConsumptionScore;
}

public PerformanceScore getPerformanceScore() {
return this.performanceScore;
}

@Override
public long getValueTime() {
return this.valueTime;
}

public void setValueTime(long valueTime) {
this.valueTime = valueTime;
}

@Override
public int getResourceId() {
return this.resourceId;
}

public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}

@Override
public int getMetricId() {
return this.metricId;
}

public void setMetricId(int metricId) {
this.metricId = metricId;
}
}
2 changes: 1 addition & 1 deletion tma-framework-k
Submodule tma-framework-k updated 87 files
+5 −6 database/TMA-K_create_database.sql
+103 −99 database/TMA-K_create_database_raw.sql
+0 −1 development/data-loader/.gitignore
+2 −0 development/mysql-host-volume/TMA-K_insert_example_data.sql
+2 −0 development/mysql/TMA-K_insert_example_data.sql
+2 −2 development/tma-admin-console/pom.xml
+4 −4 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/AdminConsole.java
+1 −1 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/KeyManager.java
+1 −1 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/database/Action.java
+1 −1 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/database/ActionManager.java
+1 −1 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/database/ActuatorManager.java
+1 −1 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/database/Configuration.java
+1 −1 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/database/DatabaseManager.java
+1 −1 development/tma-admin-console/src/main/java/eu/atmosphere/tma/admin/database/ResourceManager.java
+2 −2 development/tma-admin-console/src/main/resources/log4j2.xml
+3 −0 development/tma-admin-rest/.gitignore
+20 −0 development/tma-admin-rest/Dockerfile
+471 −0 development/tma-admin-rest/README.md
+1 −0 development/tma-admin-rest/build.sh
+17 −0 development/tma-admin-rest/nbactions.xml
+210 −0 development/tma-admin-rest/pom.xml
+1 −0 development/tma-admin-rest/run.sh
+34 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/AdminRest.java
+288 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/ActionAdminController.java
+166 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/ActuatorAdminController.java
+127 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/AdminController.java
+66 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/DescriptionAdminController.java
+140 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/KeysAdminController.java
+69 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/PartnerAdminController.java
+125 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/ProbeAdminController.java
+103 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/controller/ResourceAdminController.java
+156 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/Action.java
+131 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/Actuator.java
+121 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/Configuration.java
+52 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/DataObject.java
+121 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/Description.java
+50 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/Partner.java
+171 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/Probe.java
+132 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/dto/Resource.java
+42 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/util/Constants.java
+761 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/util/DatabaseManager.java
+55 −0 development/tma-admin-rest/src/main/java/eu/atmosphere/tma/admin/util/PropertiesManager.java
+64 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actions/css/actions.css
+15 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actions/css/createActions.css
+108 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actions/html/actions.html
+84 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actions/html/createActions.html
+423 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actions/js/actions.js
+149 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actions/js/createActions.js
+41 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actuator/css/actuator.css
+85 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actuator/html/actuator.html
+88 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/actuator/js/actuator.js
+227 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/commonFiles/css/basicContents.css
+ development/tma-admin-rest/src/main/resources/META-INF/resources/commonFiles/img/atmosphereFullLogo.png
+ development/tma-admin-rest/src/main/resources/META-INF/resources/commonFiles/img/delete.png
+57 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/commonFiles/js/getActuators.js
+49 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/commonFiles/js/partner.js
+4 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/commonFiles/js/properties.js
+76 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/commonFiles/js/status.js
+40 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/description/css/description.css
+88 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/description/html/description.html
+87 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/description/js/description.js
+144 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/css/homePage.css
+ development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/img/action.png
+ development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/img/actuator.png
+ development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/img/description.png
+ development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/img/keys.png
+ development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/img/probe.png
+ development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/img/resource.png
+32 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/homeResources/js/homePage.js
+102 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/index.html
+124 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/probe/css/probe.css
+61 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/probe/css/probeDashboard.css
+134 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/probe/html/probe.html
+83 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/probe/html/probeDashboard.html
+ development/tma-admin-rest/src/main/resources/META-INF/resources/probe/img/calendar.png
+ development/tma-admin-rest/src/main/resources/META-INF/resources/probe/img/showpassword.png
+301 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/probe/js/probe.js
+157 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/probe/js/probeDashboard.js
+9 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/resource/css/resource.css
+84 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/resource/html/resource.html
+66 −0 development/tma-admin-rest/src/main/resources/META-INF/resources/resource/js/resource.js
+2 −0 development/tma-admin-rest/src/main/resources/config.properties
+ development/tma-admin-rest/src/main/resources/favicon.ico
+18 −3 development/tma-admin-rest/src/main/resources/log4j2.xml
+32 −0 development/tma-admin-rest/tma-admin-api.yaml
+23 −3 development/tma-knowledge-db/src/main/java/eu/atmosphere/tmaf/knowledge/db/entity/ActionPlan.java
+16 −3 development/tma-knowledge-db/src/main/java/eu/atmosphere/tmaf/knowledge/db/entity/Configuration.java

0 comments on commit 26af094

Please sign in to comment.