1 17 18 package org.sape.carbon.core.component.lifecycle.test; 19 20 import org.sape.carbon.core.component.Component; 21 import org.sape.carbon.core.component.ComponentConfiguration; 22 import org.sape.carbon.core.component.lifecycle.Configurable; 23 import org.sape.carbon.core.component.lifecycle.Initializable; 24 import org.sape.carbon.core.component.lifecycle.Startable; 25 import org.sape.carbon.core.component.lifecycle.Suspendable; 26 27 31 public class DestroyOnExceptionTestComponentImpl 32 implements 33 DestroyOnExceptionTestComponent, 34 Startable, 35 Suspendable, 36 Configurable, 37 Initializable { 38 39 protected boolean crashOnConfigure; 40 protected boolean crashOnResume; 41 protected boolean crashOnSuspend; 42 protected boolean crashOnStart; 43 protected boolean crashOnStop; 44 45 48 public void crashOnConfigure() { 49 reset(); 50 this.crashOnConfigure = true; 51 } 52 53 56 public void crashOnResume() { 57 reset(); 58 this.crashOnResume = true; 59 } 60 61 64 public void crashOnStart() { 65 reset(); 66 this.crashOnStart = true; 67 } 68 69 72 public void crashOnStop() { 73 reset(); 74 this.crashOnStop = true; 75 } 76 77 80 public void crashOnSuspend() { 81 reset(); 82 this.crashOnSuspend = true; 83 } 84 85 88 public void start() throws Exception { 89 if (this.crashOnStart) { 90 throw new Exception (); 91 } 92 } 93 94 97 public void stop() throws Exception { 98 if (this.crashOnStop) { 99 throw new Exception (); 100 } 101 } 102 103 106 public void resume() throws Exception { 107 if (this.crashOnResume) { 108 throw new Exception (); 109 } 110 } 111 112 115 public void suspend() throws Exception { 116 if (this.crashOnSuspend) { 117 throw new Exception (); 118 } 119 } 120 121 124 public void configure(ComponentConfiguration configuration) 125 throws Exception { 126 127 if (this.crashOnConfigure) { 128 throw new Exception (); 129 } 130 } 131 132 135 public void initialize(Component thisComponent) throws Exception { 136 reset(); 137 } 138 139 private void reset() { 140 this.crashOnConfigure = false; 141 this.crashOnResume = false; 142 this.crashOnStart = false; 143 this.crashOnStop = false; 144 this.crashOnSuspend = false; 145 } 146 } | Popular Tags |