1 19 20 package org.apache.avalon.fortress.impl.handler; 21 22 import org.apache.avalon.framework.service.ServiceException; 23 24 31 public class AbstractReleasableComponent implements ReleasableComponent 32 { 33 private boolean initialized = false; 34 35 private ComponentHandler handler; 36 37 public void initialize(ComponentHandler handler) 38 throws Exception 39 { 40 if ( this.initialized ) 41 { 42 throw new ServiceException(this.toString(), "Handable component is already initialized."); 43 } 44 if ( handler == null ) 45 { 46 throw new ServiceException(this.toString(), "Handler is required."); 47 } 48 this.handler = handler; 49 this.initialized = true; 50 } 51 52 55 public void releaseOnComponentHandler( ) 56 { 57 if ( this.initialized ) 58 { 59 this.handler.put( this ); 60 } 61 } 62 } 63 | Popular Tags |