clean imports

This commit is contained in:
Peter Hormanns 2013-03-06 16:18:27 +01:00
parent 1816c4fc61
commit e6fb369f88
3 changed files with 20 additions and 19 deletions

View File

@ -23,7 +23,6 @@ import javax.persistence.Temporal;
import javax.persistence.Transient;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AnnModuleImpl;
import de.hsadmin.mods.pac.Pac;
import de.hsadmin.mods.user.UnixUser;

View File

@ -43,7 +43,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
mainProcessor.appendProcessor(hiveName, createHiveEMailSetupProcessor(em, dom), "Setup EMail");
Config config = Config.getInstance();
for (String queueName : config.getProperty("queues.dns").split(",")) {
mainProcessor.appendProcessor(queueName, createDNSServerSetupProcessor(dom.getName(), pac.getHive().getInetAddr().getInetAddr()), queueName + ".hostsharing.net");
mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
}
for (String queueName : config.getProperty("queues.mail").split(",")) {
mainProcessor.appendProcessor(queueName, createMailinSetupProcessor(em, dom, pac), queueName + ".hostsharing.net");
@ -73,7 +73,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
);
Config config = Config.getInstance();
for (String queueName : config.getProperty("queues.dns").split(",")) {
mainProcessor.appendProcessor(queueName, createDNSServerRemoveProcessor(domName), queueName + ".hostsharing.net");
mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
}
for (String queueName : config.getProperty("queues.mail").split(",")) {
mainProcessor.appendProcessor(queueName, createMailinUnsetupProcessor(em, dom), queueName + ".hostsharing.net");
@ -124,22 +124,16 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
return emailAdrProcessor;
}
private Processor createDNSServerSetupProcessor(String domName, String hiveInetAddr) {
Processor seczonesFileProcessor;
seczonesFileProcessor =
new ShellProcessor("echo 'zone \"" + domName + "\" { type slave; file \"sec." + domName + "\"; masters { " + hiveInetAddr + "; }; };' >>/etc/bind/named-hsh.conf" +
" && sort /etc/bind/named-hsh.conf | uniq >/etc/bind/named-hsh.conf.tmp" +
" && mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf" +
" && invoke-rc.d bind9 reload");
return seczonesFileProcessor;
}
private Processor createDNSServerRemoveProcessor(String domName) {
// TODO Use templates and regenerate the file.
return new ShellProcessor("grep -v '\"sec." + domName + "\"' /etc/bind/named-hsh.conf >/etc/bind/named-hsh.conf.tmp" +
" && mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf" +
" && rm /var/cache/bind/sec." + domName +
" && invoke-rc.d bind9 reload");
private Processor createDNSServerConfigProcessor(EntityManager em) {
Query query = em.createQuery("SELECT d FROM Domains d");
HashMap<String, Object> templateVars = new HashMap<String, Object>();
templateVars.put("domains", query.getResultList());
return new CompoundProcessor(
new VelocityProcessor("/de/hsadmin/mods/dom/named-hsh-conf.vm",
templateVars, "/etc/bind/named-hsh.conf.tmp", true),
new ShellProcessor(" ( diff -q /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && rm /etc/bind/named-hsh.conf.tmp ) " +
"|| ( mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf && invoke-rc.d bind9 reload )")
);
}
private Processor createMailinSetupProcessor(EntityManager em, Domain dom, Pac pac) throws ProcessorException {

View File

@ -0,0 +1,8 @@
//
// This file is managed by HSAdmin.
// Do not edit manually. Changes will be overwritten.
//
#foreach( $domain in ${domains} )
zone "${domain.name}" { type slave; file "sec.${domain.name}"; masters { ${domain.user.pac.hive.inetaddr}; }; };
#end