Commit c4b393bd877641da4cdb64aab64673fdd1fd7dfe

Authored by Paul Brodner
1 parent 6c7a449a87
Exists in master

add version

src/main/java/org/alfresco/tasenvironment/models/Environment.java
... ... @@ -2,6 +2,9 @@ package org.alfresco.tasenvironment.models;
2 2  
3 3 import org.alfresco.utility.network.ServerHealth;
4 4 import org.alfresco.utility.network.TenantConsole;
  5 +import org.apache.commons.httpclient.HttpClient;
  6 +import org.apache.commons.httpclient.methods.GetMethod;
  7 +import org.apache.commons.io.IOUtils;
5 8 import org.springframework.data.annotation.Id;
6 9 import org.springframework.data.annotation.PersistenceConstructor;
7 10 import org.springframework.data.mongodb.core.mapping.Document;
... ... @@ -129,4 +132,22 @@ public class Environment
129 132 return "<span class=\"label label-success\">No</span>";
130 133 }
131 134 }
  135 +
  136 + public String getVersion()
  137 + {
  138 + HttpClient client = new HttpClient();
  139 + GetMethod get = new GetMethod("http://"+ getIp() + "/alfresco/service/api/server");
  140 + String version = "Unknown";
  141 + get.getParams().setSoTimeout(5000);
  142 + try
  143 + {
  144 + client.executeMethod(get);
  145 + version = IOUtils.toString(get.getResponseBodyAsStream());
  146 + }
  147 + catch (Exception e)
  148 + {
  149 + }
  150 +
  151 + return version ;
  152 + }
132 153 }
133 154 \ No newline at end of file
... ...
src/main/resources/spark/template/freemarker/environment/index.ftl
... ... @@ -7,6 +7,7 @@
7 7 <th>Alfresco Path</th>
8 8 <th>Status</th>
9 9 <th>With Tenant</th>
  10 + <th>Version</th>
10 11 <th></th>
11 12 </tr>
12 13 </thead>
... ... @@ -18,6 +19,7 @@
18 19 <td><a href="${env.getAlfrescoPath()}" target="_blank">${env.getAlfrescoPath()}</a></td>
19 20 <td align="center">${env.getStatus()}</td>
20 21 <td align="center">${env.getTenant()}</td>
  22 + <td><pre>${env.getVersion()}</pre></td>
21 23 <td>
22 24 <form method="DELETE" action="/environment/delete/${env.getId()}">
23 25 <button type="submit" class="btn btn-small">Delete</button>
... ...