1 37 package net.sourceforge.cruisecontrol.listeners; 38 39 import net.sourceforge.cruisecontrol.CruiseControlException; 40 import net.sourceforge.cruisecontrol.Listener; 41 import net.sourceforge.cruisecontrol.ProjectEvent; 42 import net.sourceforge.cruisecontrol.util.ValidationHelper; 43 import org.apache.log4j.Logger; 44 45 65 public class ListenerTestPlugin implements Listener { 66 private static final Logger LOG = Logger.getLogger(ListenerTestPlugin.class); 67 68 private ProjectEvent lastEvent; 69 private String string; 70 private String otherString; 71 private StringWrapper stringWrapper; 72 private ListenerTestNestedPlugin nested; 73 private ListenerTestSelfConfiguringPlugin selfConfiguring; 74 75 public void handleEvent(ProjectEvent event) throws CruiseControlException { 76 lastEvent = event; 77 } 78 79 public void validate() throws CruiseControlException { 80 LOG.debug("validate()"); 81 ValidationHelper.assertIsSet(string, "string", this.getClass()); 82 } 85 86 public ProjectEvent getLastEvent() { 87 return lastEvent; 88 } 89 90 public void setString(String string) { 91 this.string = string.trim(); 92 } 93 94 public void setOtherString(String otherString) { 95 this.otherString = otherString; 96 } 97 98 public static class StringWrapper { 99 private String string; 100 101 public String getString() { 102 return string; 103 } 104 105 public void setString(String string) { 106 this.string = string; 107 } 108 } 109 110 115 116 public Object createStringWrapper() { 117 return stringWrapper = new StringWrapper(); 118 } 119 120 public void add(ListenerTestNestedPlugin nested) { 121 this.nested = nested; 122 } 123 124 public void add(ListenerTestSelfConfiguringPlugin selfConfiguring) { 125 this.selfConfiguring = selfConfiguring; 126 } 127 128 public String getString() { 129 return string; 130 } 131 132 public String getOtherString() { 133 return otherString; 134 } 135 136 public StringWrapper getStringWrapper() { 137 return stringWrapper; 138 } 139 140 public ListenerTestNestedPlugin getNested() { 141 return nested; 142 } 143 144 public ListenerTestSelfConfiguringPlugin getSelfConfiguring() { 145 return selfConfiguring; 146 } 147 } 148 | Popular Tags |