Refactoring of WANavigation and i,plementation of Service Status
This commit is contained in:
parent
e201f9ce4c
commit
b115a9cb4f
14 changed files with 101 additions and 91 deletions
|
|
@ -26,7 +26,6 @@ public class ApacheConfig implements WAServiceConfig {
|
|||
vhosts = new LinkedList<ApacheConfigVirtualHost>();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void read() throws SQLException {
|
||||
DBConnection db = WAConstants.getDB();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import java.util.logging.Logger;
|
|||
|
||||
public class ApacheStatus extends WAServiceStatus {
|
||||
private static final Logger log = LogUtil.getLogger();
|
||||
private static final String PID_FILE = "/var/run/apache2.pid";
|
||||
private static final String PID_FILE_PATH = "/var/run/apache2.pid";
|
||||
|
||||
private static OSAbstractionLayer os = OSAbstractionLayer.getInstance();
|
||||
|
||||
|
|
@ -58,11 +58,14 @@ public class ApacheStatus extends WAServiceStatus {
|
|||
@Override
|
||||
public ServiceStatusType getStatus() {
|
||||
try {
|
||||
int pid = Integer.parseInt(
|
||||
FileUtil.getContent(new File(PID_FILE)));
|
||||
if(Ps.isRunning(pid))
|
||||
return ServiceStatusType.RUNNING;
|
||||
return ServiceStatusType.STOPPED;
|
||||
File pidFile = new File(PID_FILE_PATH);
|
||||
if(pidFile.exists()) {
|
||||
int pid = Integer.parseInt(
|
||||
FileUtil.getContent(pidFile));
|
||||
if (Ps.isRunning(pid))
|
||||
return ServiceStatusType.RUNNING;
|
||||
return ServiceStatusType.STOPPED;
|
||||
}
|
||||
}catch(IOException e){
|
||||
log.log(Level.WARNING, null, e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
"version": "1.0",
|
||||
"name": "Apache Web Server",
|
||||
"interfaces": {
|
||||
"wa.server.plugin.WAService": "wa.server.plugin.apache.ApacheService"
|
||||
"wa.server.plugin.WAService": "wa.server.plugin.apache.ApacheService",
|
||||
"wa.server.plugin.WAServiceStatus": "wa.server.plugin.apache.ApacheStatus"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue