HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2017-10-04 a9f0fb69857fd6994c639d202fd56c6ca268411c
clean code
2 files modified
36 ■■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java 9 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java 27 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
@@ -185,15 +185,6 @@
        if (dom.getValidsubdomainnames() == null) {
            dom.setValidsubdomainnames("www");
        }
//        if (dom.isPacDomain()) {
//            em.persist(new EMailAddress("owner", "", dom, dom.getUser().getPac().getCustomer().getName().substring(6) + "@hostsharing.net"));
//            em.persist(new EMailAddress("admin", "", dom, dom.getUser().getPac().getName() + "@hostsharing.net"));
//            em.persist(new EMailAddress(dom.getUser().getPac().getName(), "", dom, dom.getUser().getPac().getName() + "@hostsharing.net"));
//        } else {
//            em.persist(new EMailAddress("abuse", "", dom, admin.getName()));
//            em.persist(new EMailAddress("postmaster", "", dom, admin.getName()));
//            em.persist(new EMailAddress("webmaster", "", dom, admin.getName()));
//        }
        final AbstractEntity newDomain = super.add(dom);
        final GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
        if (dom.isPacDomain()) {
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -4,7 +4,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -21,8 +20,6 @@
import de.hsadmin.core.qserv.VelocityProcessor;
import de.hsadmin.core.qserv.WaitingTasksProcessor;
import de.hsadmin.core.util.Config;
import de.hsadmin.mods.email.EMailAddress;
import de.hsadmin.mods.email.EMailAddressProcessorFactory;
import de.hsadmin.mods.pac.Pac;
import de.hsadmin.mods.user.UnixUser;
@@ -32,19 +29,13 @@
        "htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "app", "app-ssl", "etc", "var" 
    };
    
    private static final Logger LOG = Logger.getLogger(DomainProcessorFactory.class.getName());
    public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) throws ProcessorException {
        String hiveName = entity.getHiveName();
        Domain dom = (Domain) entity;
        UnixUser domUser = dom.getUser();
        Pac pac = domUser.getPac();
        WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(
                new CompoundProcessor(
                    createHiveDNSSetupProcessor(em, dom)
//                    ,
//                    createHiveEMailSetupProcessor(em, dom)
                )
                new CompoundProcessor(createHiveDNSSetupProcessor(em, dom))
            );
        Config config = Config.getInstance();
        for (String queueName : config.getProperty("queues.dns").split(",")) {
@@ -136,22 +127,6 @@
            " && rm /etc/bind/pri." + domName +
            " && invoke-rc.d bind9 reload");
    }
//    private CompoundProcessor createHiveEMailSetupProcessor(EntityManager em, Domain dom) {
//        LOG.info("createHiveEMailSetupProcessor( " + dom.getName() + " )");
//        final EMailAddressProcessorFactory eMailAddressProcessorFactory = new EMailAddressProcessorFactory();
//        final CompoundProcessor emailAdrProcessor = new CompoundProcessor();
//        final Query query = em.createQuery(
//            "SELECT adr FROM EMailAddresses adr WHERE adr.domain.name = :domname");
//        query.setParameter("domname", dom.getName());
//        final List<?> resultList = query.getResultList();
//        for (final Object obj : resultList) {
//            final EMailAddress eMailAddress = (EMailAddress) obj;
//            LOG.info("EMail: " + eMailAddress.getEMailAddress());
//            emailAdrProcessor.appendProcessor(eMailAddressProcessorFactory.createCreateProcessor(em, eMailAddress));
//        }
//        return emailAdrProcessor;
//    }
    private Processor createMailinSetupProcessor(EntityManager em, Domain dom, Pac pac) throws ProcessorException {
        final String inetAddr = pac.getCurINetAddr().getInetAddr();