1 /* 2 * Copyright 2004 Apache Software Foundation 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 * implied. 13 * 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package tutorial.publisher; 19 20 import java.io.File; 21 22 import org.apache.avalon.framework.logger.Logger; 23 import org.apache.avalon.framework.logger.AbstractLogEnabled; 24 import org.apache.avalon.framework.service.Serviceable; 25 import org.apache.avalon.framework.service.ServiceManager; 26 import org.apache.avalon.framework.service.ServiceException; 27 import org.apache.avalon.framework.activity.Disposable; 28 29 /** 30 * PublisherComponent from Merlin's Composition Tutorial 31 * 32 * @avalon.component version="1.0" name="publisher" 33 * @avalon.service type="tutorial.publisher.PublisherService" 34 * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a> 35 */ 36 public class PublisherComponent extends AbstractLogEnabled implements PublisherService, Disposable 37 { 38 /** 39 * Supply of the logging channel by the container. 40 * @param logger the logging channel 41 */ 42 public void enableLogging( Logger logger ) 43 { 44 logger.info( "created" ); 45 super.enableLogging( logger ); 46 } 47 48 /** 49 * Publish a message. 50 * @param message the message to publish 51 */ 52 public void publish( String message ) 53 { 54 getLogger().info( message ); 55 } 56 57 public void dispose() 58 { 59 getLogger().info( "disposal" ); 60 } 61 62 } 63 64