| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | createHttpdVirtualProc(hive), |
| | | createAccountingRulesProc()); |
| | | } else { |
| | | return new ShellProcessor("exit 0"); //TODO: Nothing should happen here. |
| | | return new NullProcessor(); |
| | | } |
| | | } |
| | | |
| | |
| | | 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( |
| | |
| | | createAccountingRulesProc()), "remove packet"); |
| | | return waiting; |
| | | } else { |
| | | return new ShellProcessor("exit 0"); //TODO: Nothing should happen here. |
| | | return new NullProcessor(); |
| | | } |
| | | } |
| | | |