1 13 package org.ejbca.ui.web.admin.services.servicetypes; 14 15 import java.io.ByteArrayInputStream ; 16 import java.io.ByteArrayOutputStream ; 17 import java.io.IOException ; 18 import java.util.ArrayList ; 19 import java.util.Collection ; 20 import java.util.Properties ; 21 22 31 public class CustomWorkerType extends WorkerType { 32 33 public static final String NAME = "CUSTOMWORKER"; 34 35 public CustomWorkerType() { 36 super("customworker.jsp", NAME, true); 37 38 compatibleActionTypeNames.add(CustomActionType.NAME); 39 compatibleActionTypeNames.add(NoActionType.NAME); 40 compatibleActionTypeNames.add(MailActionType.NAME); 41 42 compatibleIntervalTypeNames.add(CustomIntervalType.NAME); 43 compatibleIntervalTypeNames.add(PeriodicalIntervalType.NAME); 44 } 45 46 private String classPath; 47 private String propertyText; 48 private Collection compatibleActionTypeNames = new ArrayList (); 49 private Collection compatibleIntervalTypeNames = new ArrayList (); 50 51 54 public String getPropertyText() { 55 return propertyText; 56 } 57 58 61 public void setPropertyText(String propertyText) { 62 this.propertyText = propertyText; 63 } 64 65 68 public void setClassPath(String classPath) { 69 this.classPath = classPath; 70 } 71 72 public String getClassPath() { 73 return classPath; 74 } 75 76 public Properties getProperties(ArrayList errorMessages) throws IOException { 77 Properties retval = new Properties (); 78 retval.load(new ByteArrayInputStream (getPropertyText().getBytes())); 79 return retval; 80 } 81 82 public void setProperties(Properties properties) throws IOException { 83 ByteArrayOutputStream baos = new ByteArrayOutputStream (); 84 properties.store(baos, null); 85 setPropertyText(new String (baos.toByteArray())); 86 } 87 88 91 public Collection getCompatibleActionTypeNames() { 92 return compatibleActionTypeNames; 93 } 94 95 98 public Collection getCompatibleIntervalTypeNames() { 99 return compatibleIntervalTypeNames; 100 } 101 102 public boolean isCustom() { 103 return true; 104 } 105 106 } 107 | Popular Tags |