HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2013-04-24 51f563d2080d147dfa404464339d48a396bd888a
enqueue processors only on web packets
3 files modified
1 files added
40 ■■■■ changed files
hsarback/database/data.sql 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/model/AbstractModuleImpl.java 4 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/qserv/NullProcessor.java 18 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java 16 ●●●●● patch | view | raw | blame | history
hsarback/database/data.sql
@@ -6,7 +6,7 @@
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number) 
    VALUES ('SW/B', 'Static-Web/Base', 300, true, 200);
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number) 
    VALUES ('WEB', 'Web/Base', 100, true, 300);
    VALUES ('PAC', 'PAC/Web', 100, true, 300);
    
--
-- Table: basecomponent
hsarback/src/de/hsadmin/core/model/AbstractModuleImpl.java
@@ -10,6 +10,7 @@
import javax.persistence.Query;
import de.hsadmin.core.qserv.EntityProcessorFactory;
import de.hsadmin.core.qserv.NullProcessor;
import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.QueueTask;
import de.hsadmin.mods.user.UnixUser;
@@ -179,6 +180,9 @@
    }
    protected void queueProcessor(Processor proc, UnixUser user, AbstractEntity entity, String action) {
        if (proc == null || proc instanceof NullProcessor) {
            return;
        }
        Entity entityInfo = entity.getClass().getAnnotation(Entity.class);
        String entityTypeName = entityInfo != null ? entityInfo.name() : entity.getClass().getSimpleName();
        StringBuilder details = new StringBuilder();
hsarback/src/de/hsadmin/core/qserv/NullProcessor.java
New file
@@ -0,0 +1,18 @@
package de.hsadmin.core.qserv;
public class NullProcessor extends AbstractProcessor {
    private static final long serialVersionUID = 1L;
    @Override
    public Object process() throws ProcessorException {
        return "nil";
    }
    @Override
    public String logInfo() {
        return "NullProcessor\n";
    }
}
hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -8,6 +8,7 @@
import de.hsadmin.core.qserv.CompoundProcessor;
import de.hsadmin.core.qserv.CreateFileProcessor;
import de.hsadmin.core.qserv.EntityProcessorFactory;
import de.hsadmin.core.qserv.NullProcessor;
import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.ProcessorException;
import de.hsadmin.core.qserv.ShellProcessor;
@@ -23,7 +24,8 @@
    public <T extends AbstractEntity> Processor createCreateProcessor(
            EntityManager em, T entity) throws ProcessorException {
        Pac pac = (Pac) entity;
        if (pac.getBasepac().getName().startsWith("PAC/")) {
        String basepacName = pac.getBasepac().getName();
        if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) {
            String pacName = pac.getName();
            Hive hive = pac.getHive();
            UnixUser unixUser = getPacAdminUser(pac);
@@ -41,7 +43,7 @@
                createHttpdVirtualProc(hive),
                createAccountingRulesProc());
        } else {
            return new ShellProcessor("exit 0"); //TODO: Nothing should happen here.
            return new NullProcessor();
        }
    }
@@ -76,17 +78,19 @@
    public <T extends AbstractEntity> Processor createUpdateProcessor(EntityManager em, T entity) 
            throws ProcessorException {
        Pac pac = (Pac) entity;
        if (pac.getBasepac().getName().startsWith("PAC/")) {
        String basepacName = pac.getBasepac().getName();
        if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) {
            return createSetQuotaProc(pac);
        } else {
            return new ShellProcessor("exit 0"); //TODO: Nothing should happen here.
            return new NullProcessor();
        }                    
    }
    @Override
    public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException {
        Pac pac = (Pac) entity;
        if (pac.getBasepac().getName().startsWith("PAC/")) {
        String basepacName = pac.getBasepac().getName();
        if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) {
            Hive hive = pac.getHive();
            WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName()));
            waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor(
@@ -99,7 +103,7 @@
                createAccountingRulesProc()), "remove packet");
            return waiting;
        } else {
            return new ShellProcessor("exit 0"); //TODO: Nothing should happen here.
            return new NullProcessor();
        }                            
    }