Some small changes to method names
This commit is contained in:
parent
4ece2b0cd2
commit
1053713d15
13 changed files with 61 additions and 167 deletions
|
|
@ -8,12 +8,12 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
|
||||
import wa.server.WAConstants;
|
||||
import wa.server.plugin.WAConfiguration;
|
||||
import wa.server.plugin.WAServiceConfig;
|
||||
import wa.server.util.ConfigFileUtil;
|
||||
import zutil.db.DBConnection;
|
||||
import zutil.io.file.FileUtil;
|
||||
|
||||
public class ApacheConfiguration implements WAConfiguration {
|
||||
public class ApacheConfig implements WAServiceConfig {
|
||||
private static final String APACHE_CONF_FILE = "wa_apache_vhost.conf";
|
||||
private static final String APACHE_MAIN_CONFIG_FILE = "/etc/apache2/apache2.conf";
|
||||
private static final String STATIC_PRE_CONF = "wa/server/plugin/apache/apache_default.config";
|
||||
|
|
@ -22,20 +22,21 @@ public class ApacheConfiguration implements WAConfiguration {
|
|||
List<ApacheConfigVirtualHost> vhosts;
|
||||
|
||||
|
||||
public ApacheConfiguration(){
|
||||
public ApacheConfig(){
|
||||
vhosts = new LinkedList<ApacheConfigVirtualHost>();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void read(DBConnection db) throws SQLException {
|
||||
public void read() throws SQLException {
|
||||
DBConnection db = WAConstants.getDB();
|
||||
vhosts = ApacheConfigVirtualHost.load(db, ApacheConfigVirtualHost.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(DBConnection db) throws IOException {
|
||||
public void save() throws IOException {
|
||||
File file = WAConstants.getConfigFile(APACHE_CONF_FILE);
|
||||
// Update Man configuration file
|
||||
// Update main configuration file
|
||||
ConfigFileUtil.writeBetweenBoundary(
|
||||
new File(APACHE_MAIN_CONFIG_FILE),
|
||||
"#",
|
||||
|
|
@ -48,9 +49,7 @@ public class ApacheConfiguration implements WAConfiguration {
|
|||
out.println("######################################");
|
||||
out.println("# vhost.php");
|
||||
for(ApacheConfigVirtualHost vhost : vhosts){
|
||||
if(vhost.isTomcatApp())
|
||||
writeTomcatVhost(out, vhost);
|
||||
else if(vhost.isSSL())
|
||||
if(vhost.isSSL())
|
||||
writeSSLVhost(out, vhost);
|
||||
else
|
||||
writeVhost(out, vhost);
|
||||
|
|
@ -9,7 +9,6 @@ public class ApacheConfigVirtualHost extends DBBean{
|
|||
protected String domain;
|
||||
protected String path;
|
||||
protected boolean ssl;
|
||||
protected boolean tomcat;
|
||||
|
||||
|
||||
|
||||
|
|
@ -31,10 +30,4 @@ public class ApacheConfigVirtualHost extends DBBean{
|
|||
public void setSSL(boolean ssl) {
|
||||
this.ssl = ssl;
|
||||
}
|
||||
public boolean isTomcatApp() {
|
||||
return tomcat;
|
||||
}
|
||||
public void setTomcatApp(boolean tomcat) {
|
||||
this.tomcat = tomcat;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,17 @@ import zutil.osal.app.linux.AptGet;
|
|||
public class ApacheInstaller implements WAInstaller {
|
||||
private static final String PACKAGES = "apache php5 php5-mcrypt php5-gd imagemagick";
|
||||
|
||||
@Override
|
||||
public boolean isInstalled() {
|
||||
String[] tmp = PACKAGES.split(" ");
|
||||
for(String pkgName : tmp){
|
||||
AptGet.Package pkg = AptGet.getPackage(PACKAGES);
|
||||
if( pkg == null || pkg.getCurrentState() != AptGet.Package.PackageState.Installed)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void install() {
|
||||
AptGet.install(PACKAGES);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
package wa.server.plugin.apache;
|
||||
|
||||
import wa.server.plugin.WAConfiguration;
|
||||
import wa.server.plugin.WAServiceConfig;
|
||||
import wa.server.plugin.WAInstaller;
|
||||
import wa.server.plugin.WAService;
|
||||
import wa.server.plugin.WAServiceStatus;
|
||||
|
|
@ -60,7 +60,7 @@ public class ApacheService implements WAService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public WAConfiguration[] getConfigurations() {
|
||||
return new WAConfiguration[0];
|
||||
public WAServiceConfig[] getConfigurations() {
|
||||
return new WAServiceConfig[0];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue