1 17 18 package tutorial.application; 19 20 import java.io.File ; 21 22 import org.apache.avalon.framework.logger.AbstractLogEnabled; 23 import org.apache.avalon.framework.service.Serviceable; 24 import org.apache.avalon.framework.service.ServiceManager; 25 import org.apache.avalon.framework.service.ServiceException; 26 import org.apache.avalon.framework.activity.Disposable; 27 28 import tutorial.location.LocationService; 29 import tutorial.publisher.PublisherService; 30 31 37 public class Application extends AbstractLogEnabled implements Serviceable, Disposable 38 { 39 40 51 public void service( ServiceManager manager ) throws ServiceException 52 { 53 getLogger().info( "servicing application" ); 54 55 LocationService locator = (LocationService) manager.lookup( "locator" ); 56 PublisherService publisher = (PublisherService) manager.lookup( "publisher" ); 57 58 63 publisher.publish( 64 "\n******************" 65 + "\n* " + locator.getLocation() 66 + "\n******************"); 67 68 getLogger().info( "done" ); 69 } 70 71 public void dispose() 72 { 73 getLogger().info( "disposal" ); 74 } 75 } 76 77 | Popular Tags |