enqueue processors only on web packets
This commit is contained in:
parent
2fc3ba4741
commit
51f563d208
@ -6,7 +6,7 @@ INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_nu
|
|||||||
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
|
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
|
||||||
VALUES ('SW/B', 'Static-Web/Base', 300, true, 200);
|
VALUES ('SW/B', 'Static-Web/Base', 300, true, 200);
|
||||||
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
|
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
|
-- Table: basecomponent
|
||||||
|
@ -10,6 +10,7 @@ import javax.persistence.NonUniqueResultException;
|
|||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
||||||
import de.hsadmin.core.qserv.EntityProcessorFactory;
|
import de.hsadmin.core.qserv.EntityProcessorFactory;
|
||||||
|
import de.hsadmin.core.qserv.NullProcessor;
|
||||||
import de.hsadmin.core.qserv.Processor;
|
import de.hsadmin.core.qserv.Processor;
|
||||||
import de.hsadmin.core.qserv.QueueTask;
|
import de.hsadmin.core.qserv.QueueTask;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
@ -179,6 +180,9 @@ public abstract class AbstractModuleImpl implements ModuleInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void queueProcessor(Processor proc, UnixUser user, AbstractEntity entity, String action) {
|
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);
|
Entity entityInfo = entity.getClass().getAnnotation(Entity.class);
|
||||||
String entityTypeName = entityInfo != null ? entityInfo.name() : entity.getClass().getSimpleName();
|
String entityTypeName = entityInfo != null ? entityInfo.name() : entity.getClass().getSimpleName();
|
||||||
StringBuilder details = new StringBuilder();
|
StringBuilder details = new StringBuilder();
|
||||||
|
18
hsarback/src/de/hsadmin/core/qserv/NullProcessor.java
Normal file
18
hsarback/src/de/hsadmin/core/qserv/NullProcessor.java
Normal 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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,6 +8,7 @@ import de.hsadmin.core.model.AbstractEntity;
|
|||||||
import de.hsadmin.core.qserv.CompoundProcessor;
|
import de.hsadmin.core.qserv.CompoundProcessor;
|
||||||
import de.hsadmin.core.qserv.CreateFileProcessor;
|
import de.hsadmin.core.qserv.CreateFileProcessor;
|
||||||
import de.hsadmin.core.qserv.EntityProcessorFactory;
|
import de.hsadmin.core.qserv.EntityProcessorFactory;
|
||||||
|
import de.hsadmin.core.qserv.NullProcessor;
|
||||||
import de.hsadmin.core.qserv.Processor;
|
import de.hsadmin.core.qserv.Processor;
|
||||||
import de.hsadmin.core.qserv.ProcessorException;
|
import de.hsadmin.core.qserv.ProcessorException;
|
||||||
import de.hsadmin.core.qserv.ShellProcessor;
|
import de.hsadmin.core.qserv.ShellProcessor;
|
||||||
@ -23,7 +24,8 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
|||||||
public <T extends AbstractEntity> Processor createCreateProcessor(
|
public <T extends AbstractEntity> Processor createCreateProcessor(
|
||||||
EntityManager em, T entity) throws ProcessorException {
|
EntityManager em, T entity) throws ProcessorException {
|
||||||
Pac pac = (Pac) entity;
|
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();
|
String pacName = pac.getName();
|
||||||
Hive hive = pac.getHive();
|
Hive hive = pac.getHive();
|
||||||
UnixUser unixUser = getPacAdminUser(pac);
|
UnixUser unixUser = getPacAdminUser(pac);
|
||||||
@ -41,7 +43,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
|||||||
createHttpdVirtualProc(hive),
|
createHttpdVirtualProc(hive),
|
||||||
createAccountingRulesProc());
|
createAccountingRulesProc());
|
||||||
} else {
|
} else {
|
||||||
return new ShellProcessor("exit 0"); //TODO: Nothing should happen here.
|
return new NullProcessor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,17 +78,19 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
|||||||
public <T extends AbstractEntity> Processor createUpdateProcessor(EntityManager em, T entity)
|
public <T extends AbstractEntity> Processor createUpdateProcessor(EntityManager em, T entity)
|
||||||
throws ProcessorException {
|
throws ProcessorException {
|
||||||
Pac pac = (Pac) entity;
|
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);
|
return createSetQuotaProc(pac);
|
||||||
} else {
|
} else {
|
||||||
return new ShellProcessor("exit 0"); //TODO: Nothing should happen here.
|
return new NullProcessor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException {
|
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException {
|
||||||
Pac pac = (Pac) entity;
|
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();
|
Hive hive = pac.getHive();
|
||||||
WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName()));
|
WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName()));
|
||||||
waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor(
|
waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor(
|
||||||
@ -99,7 +103,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
|||||||
createAccountingRulesProc()), "remove packet");
|
createAccountingRulesProc()), "remove packet");
|
||||||
return waiting;
|
return waiting;
|
||||||
} else {
|
} else {
|
||||||
return new ShellProcessor("exit 0"); //TODO: Nothing should happen here.
|
return new NullProcessor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user