Converting service to pure page
This commit is contained in:
parent
3a0f40dab9
commit
f2b4cfdec7
23 changed files with 140 additions and 219 deletions
0
src/META-INF/MANIFEST.MF
Normal file → Executable file
0
src/META-INF/MANIFEST.MF
Normal file → Executable file
0
src/examples/real_time_status.jsp
Normal file → Executable file
0
src/examples/real_time_status.jsp
Normal file → Executable file
|
|
@ -29,6 +29,7 @@ import zutil.db.handler.SimpleSQLResult;
|
|||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.net.http.HttpHeader;
|
||||
import zutil.plugin.PluginManager;
|
||||
import zutil.ui.Navigation;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -45,6 +46,8 @@ public class WAContext {
|
|||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static Navigation rootNav;
|
||||
public static DBConnection db;
|
||||
private static PluginManager pluginManager;
|
||||
|
||||
|
||||
private ArrayList<WAAlert> alerts;
|
||||
// Navigation
|
||||
|
|
@ -52,6 +55,7 @@ public class WAContext {
|
|||
private List<Navigation> breadcrumb;
|
||||
|
||||
|
||||
|
||||
public WAContext(HttpHeader header){
|
||||
// Navigation
|
||||
navInstance = rootNav.createPagedNavInstance(header);
|
||||
|
|
@ -77,6 +81,7 @@ public class WAContext {
|
|||
|
||||
protected static void initialize(){
|
||||
try {
|
||||
pluginManager = new PluginManager();
|
||||
rootNav = Navigation.createRootNav();
|
||||
|
||||
|
||||
|
|
@ -119,5 +124,7 @@ public class WAContext {
|
|||
public static Navigation getRootNav(){
|
||||
return rootNav;
|
||||
}
|
||||
|
||||
public static PluginManager getPluginManager() {
|
||||
return pluginManager;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package wa.server;
|
||||
|
||||
import wa.server.plugin.WAPage;
|
||||
import wa.server.page.WAPage;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.CompactLogFormatter;
|
||||
import zutil.log.LogUtil;
|
||||
|
|
@ -26,10 +26,9 @@ public class WebAdminServer {
|
|||
public WebAdminServer(){
|
||||
try {
|
||||
WAContext.initialize();
|
||||
PluginManager pluginManager = new PluginManager();
|
||||
|
||||
HttpServer http = new HttpServer(80);
|
||||
for (Iterator<WAPage> it = pluginManager.getObjectIterator(WAPage.class); it.hasNext(); ){
|
||||
for (Iterator<WAPage> it = WAContext.getPluginManager().getObjectIterator(WAPage.class); it.hasNext(); ){
|
||||
WAPage page = it.next();
|
||||
if (page.getPageName() != null)
|
||||
http.setPage(page.getPageName(), page);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ package wa.server.page;
|
|||
|
||||
import wa.server.WAContext;
|
||||
import wa.server.plugin.WAConfigEntry;
|
||||
import wa.server.plugin.WAPage;
|
||||
import wa.server.plugin.WAServiceConfig;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.LogUtil;
|
||||
|
|
|
|||
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2015 ezivkoc
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package wa.server.page;
|
||||
|
||||
import wa.server.WAContext;
|
||||
import wa.server.plugin.WAPage;
|
||||
import wa.server.plugin.WAService;
|
||||
import wa.server.plugin.WAServiceConfig;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.net.http.HttpHeader;
|
||||
import zutil.parser.Templator;
|
||||
import zutil.plugin.PluginManager;
|
||||
import zutil.ui.Navigation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Created by Ziver on 2015-04-06.
|
||||
*/
|
||||
public class ServicePage extends WAPage {
|
||||
private static final Logger log = LogUtil.getLogger();
|
||||
public static final String NAVIGATION_NAME = "Services";
|
||||
private static final String TMPL_FILE = "WebContent/page/ServicePage.tmpl";
|
||||
|
||||
|
||||
private ServiceStatusPage rootStatusPage;
|
||||
private ArrayList<WAService> services;
|
||||
private ArrayList<ServiceStatusPage> statusPages;
|
||||
private ArrayList<LogPage> logPages;
|
||||
private ArrayList<ConfigPage> configPages;
|
||||
|
||||
|
||||
public ServicePage(){
|
||||
super.setPageName("service");
|
||||
PluginManager pluginManager = new PluginManager();
|
||||
this.services = pluginManager.toArray(WAService.class);
|
||||
this.rootStatusPage = new ServiceStatusPage(pluginManager);
|
||||
this.statusPages = new ArrayList<>();
|
||||
this.logPages = new ArrayList<>();
|
||||
this.configPages = new ArrayList<>();
|
||||
|
||||
Navigation nav = WAContext.getRootNav().createSubNav(this.getPageName(), NAVIGATION_NAME);
|
||||
nav.setResource(this);
|
||||
nav.setWeight(100);
|
||||
for(WAService plugin : services) {
|
||||
statusPages.add(new ServiceStatusPage(plugin.getStatus()));
|
||||
logPages.add(new LogPage(plugin.getLog()));
|
||||
|
||||
Navigation serviceNav = nav.createSubNav(plugin.getName());
|
||||
serviceNav.setResource(plugin);
|
||||
for(WAServiceConfig conf : plugin.getConfigurations()){
|
||||
ConfigPage page = new ConfigPage(conf);
|
||||
configPages.add(page);
|
||||
serviceNav.createSubNav(conf.getName())
|
||||
.setResource(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Templator htmlResponse(WAContext context,
|
||||
HttpHeader client_info,
|
||||
Map<String, Object> session,
|
||||
Map<String, String> cookie,
|
||||
Map<String, String> request) {
|
||||
|
||||
try {
|
||||
Object resource = context.getBreadcrumb().get(context.getBreadcrumb().size()-1).getResource();
|
||||
int index;
|
||||
if((index = configPages.indexOf(resource)) >= 0){
|
||||
return configPages.get(index).htmlResponse(context, client_info, session, cookie, request);
|
||||
}
|
||||
else if ((index = services.indexOf(resource)) >= 0) {
|
||||
WAService obj = services.get(index);
|
||||
ServiceStatusPage statusPage = statusPages.get(index);
|
||||
LogPage logPage = logPages.get(index);
|
||||
|
||||
Templator tmpl = new Templator(FileUtil.find(TMPL_FILE));
|
||||
if(statusPage != null)
|
||||
tmpl.set("service_status",
|
||||
statusPage.htmlResponse(context, client_info, session, cookie, request));
|
||||
if(logPage != null)
|
||||
tmpl.set("service_logs",
|
||||
logPage.htmlResponse(context, client_info, session, cookie, request));
|
||||
return tmpl;
|
||||
}
|
||||
else{ // root page
|
||||
return rootStatusPage.htmlResponse(context, client_info, session, cookie, request);
|
||||
}
|
||||
|
||||
}catch (IOException e){
|
||||
log.log(Level.SEVERE, null, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -23,14 +23,12 @@
|
|||
package wa.server.page;
|
||||
|
||||
import wa.server.WAContext;
|
||||
import wa.server.plugin.WAPage;
|
||||
import wa.server.plugin.WAServiceStatus;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.net.http.HttpHeader;
|
||||
import zutil.parser.DataNode;
|
||||
import zutil.parser.Templator;
|
||||
import zutil.plugin.PluginManager;
|
||||
import zutil.ui.Navigation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -54,12 +52,11 @@ public class ServiceStatusPage extends WAPage {
|
|||
services = new ArrayList<>();
|
||||
services.add(ss);
|
||||
}
|
||||
public ServiceStatusPage(PluginManager pluginManager){
|
||||
this.services = pluginManager.toArray(WAServiceStatus.class);
|
||||
public ServiceStatusPage(){
|
||||
this.services = WAContext.getPluginManager().toArray(WAServiceStatus.class);
|
||||
|
||||
Navigation nav = WAContext.getRootNav().createSubNav(ServicePage.NAVIGATION_NAME)
|
||||
.createSubNav(NAVIGATION_NAME);
|
||||
nav.setResource(this);
|
||||
Navigation nav = WAContext.getRootNav().createSubNav(WAServicePage.NAVIGATION_NAME)
|
||||
.createSubNav(NAVIGATION_NAME).setWeight(-100);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package wa.server.plugin;
|
||||
package wa.server.page;
|
||||
|
||||
import wa.server.WAContext;
|
||||
import zutil.io.file.FileUtil;
|
||||
|
|
@ -31,11 +31,9 @@ import zutil.net.http.HttpPrintStream;
|
|||
import zutil.parser.DataNode;
|
||||
import zutil.parser.Templator;
|
||||
import zutil.parser.json.JSONWriter;
|
||||
import zutil.plugin.PluginManager;
|
||||
import zutil.ui.Navigation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
100
src/wa/server/page/WAServicePage.java
Executable file
100
src/wa/server/page/WAServicePage.java
Executable file
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (c) 2015 ezivkoc
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package wa.server.page;
|
||||
|
||||
import wa.server.WAContext;
|
||||
import wa.server.plugin.WAInstaller;
|
||||
import wa.server.plugin.WALog;
|
||||
import wa.server.plugin.WAServiceConfig;
|
||||
import wa.server.plugin.WAServiceStatus;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.net.http.HttpHeader;
|
||||
import zutil.parser.Templator;
|
||||
import zutil.ui.Navigation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Created by Ziver on 2015-04-06.
|
||||
*/
|
||||
public abstract class WAServicePage extends WAPage {
|
||||
private static final Logger log = LogUtil.getLogger();
|
||||
public static final String NAVIGATION_NAME = "Services";
|
||||
private static final String TMPL_FILE = "WebContent/page/ServicePage.tmpl";
|
||||
|
||||
|
||||
private ServiceStatusPage statusPage;
|
||||
private LogPage logPage;
|
||||
|
||||
|
||||
public WAServicePage(String pageName, String serviceName){
|
||||
super.setPageName("service/"+pageName);
|
||||
|
||||
Navigation rootNav = WAContext.getRootNav().createSubNav(NAVIGATION_NAME).setWeight(100);
|
||||
Navigation serviceNav = rootNav.createSubNav(getPageName(), serviceName);
|
||||
|
||||
statusPage = new ServiceStatusPage(getStatus());
|
||||
logPage = new LogPage(getLog());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Templator htmlResponse(WAContext context,
|
||||
HttpHeader client_info,
|
||||
Map<String, Object> session,
|
||||
Map<String, String> cookie,
|
||||
Map<String, String> request) throws IOException {
|
||||
|
||||
Templator tmpl = new Templator(FileUtil.find(TMPL_FILE));
|
||||
if(statusPage != null)
|
||||
tmpl.set("service_status",
|
||||
statusPage.htmlResponse(context, client_info, session, cookie, request));
|
||||
if(logPage != null)
|
||||
tmpl.set("service_logs",
|
||||
logPage.htmlResponse(context, client_info, session, cookie, request));
|
||||
return tmpl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return a service status object or null if it is not possible to check status
|
||||
*/
|
||||
public abstract WAServiceStatus getStatus();
|
||||
|
||||
/**
|
||||
* @return a service log object or null if it is not possible to read logs
|
||||
*/
|
||||
public abstract WALog getLog();
|
||||
|
||||
/**
|
||||
* @return a installer object that will install the service or null if the installer is not available
|
||||
*/
|
||||
public abstract WAInstaller getInstaller();
|
||||
}
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
package wa.server.page;
|
||||
|
||||
import wa.server.WAContext;
|
||||
import wa.server.plugin.WAPage;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -36,7 +35,7 @@ public abstract class WAStatusPage extends WAPage {
|
|||
public WAStatusPage(String subPageName, String niceName){
|
||||
super.setPageName("status/"+subPageName);
|
||||
|
||||
WAContext.getRootNav().createSubNav("status", NAVIGATION_NAME)
|
||||
WAContext.getRootNav().createSubNav(NAVIGATION_NAME)
|
||||
.setWeight(0).createSubNav(this.getPageName(), niceName);
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"version": "1.0",
|
||||
"name": "WA Core",
|
||||
"interfaces": [ ]
|
||||
"interfaces": [
|
||||
{"wa.server.page.WAPage": "wa.server.page.ServiceStatusPage"}
|
||||
]
|
||||
}
|
||||
0
src/wa/server/plugin/WAInstaller.java
Normal file → Executable file
0
src/wa/server/plugin/WAInstaller.java
Normal file → Executable file
|
|
@ -1,26 +0,0 @@
|
|||
package wa.server.plugin;
|
||||
|
||||
public interface WAService {
|
||||
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return a service status object or null if it is not possible to check status
|
||||
*/
|
||||
WAServiceStatus getStatus();
|
||||
|
||||
/**
|
||||
* @return a service log object or null if it is not possible to read logs
|
||||
*/
|
||||
WALog getLog();
|
||||
|
||||
/**
|
||||
* @return a installer object that will install the service or null if the installer is not available
|
||||
*/
|
||||
WAInstaller getInstaller();
|
||||
|
||||
/**
|
||||
* @return a array of configuration objects
|
||||
*/
|
||||
WAServiceConfig[] getConfigurations();
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ public interface WAServiceConfig {
|
|||
/**
|
||||
* @return the String name of this configuration type
|
||||
*/
|
||||
public String getName();
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Read in current configuration data
|
||||
|
|
@ -19,13 +19,13 @@ public interface WAServiceConfig {
|
|||
*/
|
||||
//public void save() throws Exception;
|
||||
|
||||
public WAConfigEntry createConfig();
|
||||
public void deleteConfig(int id);
|
||||
WAConfigEntry createConfig();
|
||||
void deleteConfig(int id);
|
||||
|
||||
/**
|
||||
* Configure service with current configuration data
|
||||
*/
|
||||
public void configure() throws Exception;
|
||||
void configure() throws Exception;
|
||||
|
||||
|
||||
|
||||
|
|
@ -34,10 +34,10 @@ public interface WAServiceConfig {
|
|||
* configuration can be changed with the
|
||||
* {@link zutil.ui.Configurator} class.
|
||||
*/
|
||||
public List<? extends WAConfigEntry> getConfigData();
|
||||
List<? extends WAConfigEntry> getConfigData();
|
||||
|
||||
/**
|
||||
* @return the class that contains the configuration data
|
||||
*/
|
||||
public Class<? extends WAConfigEntry> getConfigClass();
|
||||
Class<? extends WAConfigEntry> getConfigClass();
|
||||
}
|
||||
|
|
|
|||
0
src/wa/server/plugin/WAServiceStatus.java
Normal file → Executable file
0
src/wa/server/plugin/WAServiceStatus.java
Normal file → Executable file
|
|
@ -31,6 +31,7 @@ public class ApacheConfigVirtualHost implements WAServiceConfig{
|
|||
vhosts = DBBean.load(WAContext.getDB(), ApacheVirtualHostEntry.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return CONFIG_NAME;
|
||||
|
|
|
|||
0
src/wa/server/plugin/apache/ApacheInstaller.java
Normal file → Executable file
0
src/wa/server/plugin/apache/ApacheInstaller.java
Normal file → Executable file
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package wa.server.plugin.apache;
|
||||
|
||||
import wa.server.page.WAServicePage;
|
||||
import wa.server.plugin.*;
|
||||
import zutil.log.LogUtil;
|
||||
|
||||
|
|
@ -32,24 +33,18 @@ import java.util.logging.Logger;
|
|||
/**
|
||||
* Created by Ziver on 2014-12-23.
|
||||
*/
|
||||
public class ApacheService implements WAService {
|
||||
private static Logger logger = LogUtil.getLogger();
|
||||
public class ApacheService extends WAServicePage {
|
||||
public static final String SERVICE_NAME = "Apache2";
|
||||
|
||||
private ApacheStatus status;
|
||||
private ApacheInstaller installer;
|
||||
private WAServiceConfig[] config;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return SERVICE_NAME;
|
||||
public ApacheService() {
|
||||
super("apache", SERVICE_NAME);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public WAServiceStatus getStatus() {
|
||||
if(status == null)
|
||||
status = new ApacheStatus();
|
||||
return status;
|
||||
return new ApacheStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -59,21 +54,6 @@ public class ApacheService implements WAService {
|
|||
|
||||
@Override
|
||||
public WAInstaller getInstaller() {
|
||||
if(installer == null)
|
||||
installer = new ApacheInstaller();
|
||||
return installer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WAServiceConfig[] getConfigurations() {
|
||||
if(config == null)
|
||||
try {
|
||||
config = new WAServiceConfig[]{
|
||||
new ApacheConfigVirtualHost()
|
||||
};
|
||||
} catch (SQLException e) {
|
||||
logger.log(Level.SEVERE, null, e);
|
||||
}
|
||||
return config;
|
||||
return new ApacheInstaller();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
src/wa/server/plugin/apache/apache_default.config
Normal file → Executable file
0
src/wa/server/plugin/apache/apache_default.config
Normal file → Executable file
|
|
@ -2,7 +2,8 @@
|
|||
"version": "1.0",
|
||||
"name": "Apache Web Server",
|
||||
"interfaces": [
|
||||
{"wa.server.plugin.WAService": "wa.server.plugin.apache.ApacheService"},
|
||||
{"wa.server.plugin.WAServiceStatus": "wa.server.plugin.apache.ApacheStatus"}
|
||||
{"wa.server.page.WAServicePage": "wa.server.plugin.apache.ApacheService"},
|
||||
{"wa.server.plugin.WAServiceStatus": "wa.server.plugin.apache.ApacheStatus"},
|
||||
{"wa.server.page.WAConfigPage": "wa.server.plugin.apache.ApacheConfigVirtualHost"}
|
||||
]
|
||||
}
|
||||
|
|
@ -44,9 +44,7 @@ import java.util.Map;
|
|||
*/
|
||||
public class HDDStatus extends WAStatusPage {
|
||||
private static final String TEMPLATE = "wa/server/plugin/hwstatus/HddStatus.tmpl";
|
||||
private static final String NAVIGATION_NAME = "wa/server/plugin/hwstatus/HddStatus.tmpl";
|
||||
|
||||
private Templator tmpl;
|
||||
private int nextId;
|
||||
private HashMap<String,Integer> idMap = new HashMap<String,Integer>();
|
||||
|
||||
|
|
@ -59,9 +57,7 @@ public class HDDStatus extends WAStatusPage {
|
|||
|
||||
@Override
|
||||
public Templator htmlResponse(WAContext context, HttpHeader client_info, Map<String, Object> session, Map<String, String> cookie, Map<String, String> request) throws IOException {
|
||||
if (tmpl == null)
|
||||
tmpl = new Templator(FileUtil.getContent(FileUtil.find(TEMPLATE)));
|
||||
return tmpl;
|
||||
return new Templator(FileUtil.getContent(FileUtil.find(TEMPLATE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ import java.util.Map;
|
|||
public class HwStatus extends WAStatusPage {
|
||||
private static final String TEMPLATE = "wa/server/plugin/hwstatus/HwStatus.tmpl";
|
||||
|
||||
private Templator tmpl;
|
||||
|
||||
|
||||
public HwStatus() {
|
||||
super("hw", "Hardware Summary");
|
||||
|
|
@ -53,9 +51,7 @@ public class HwStatus extends WAStatusPage {
|
|||
|
||||
@Override
|
||||
public Templator htmlResponse(WAContext context, HttpHeader client_info, Map<String, Object> session, Map<String, String> cookie, Map<String, String> request) throws IOException {
|
||||
if (tmpl == null)
|
||||
tmpl = new Templator(FileUtil.getContent(FileUtil.find(TEMPLATE)));
|
||||
return tmpl;
|
||||
return new Templator(FileUtil.getContent(FileUtil.find(TEMPLATE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import java.util.Map;
|
|||
public class NetStatus extends WAStatusPage {
|
||||
private static final String TEMPLATE = "wa/server/plugin/hwstatus/NetStatus.tmpl";
|
||||
|
||||
private Templator tmpl;
|
||||
private int nextId;
|
||||
private HashMap<String,Integer> idMap = new HashMap<String,Integer>();
|
||||
|
||||
|
|
@ -58,9 +57,7 @@ public class NetStatus extends WAStatusPage {
|
|||
|
||||
@Override
|
||||
public Templator htmlResponse(WAContext context, HttpHeader client_info, Map<String, Object> session, Map<String, String> cookie, Map<String, String> request) throws IOException {
|
||||
if (tmpl == null)
|
||||
tmpl = new Templator(FileUtil.getContent(FileUtil.find(TEMPLATE)));
|
||||
return tmpl;
|
||||
return new Templator(FileUtil.getContent(FileUtil.find(TEMPLATE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue