import java.io.File;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.ContextException;
/**
* An example component containing meta info under javadoc tags.
*
* @avalon.component name="secondary-component" version="2.4" lifestyle="singleton"
* @avalon.service type="SecondaryService:0.1"
*/
public class Secondary extends AbstractLogEnabled
implements Serviceable, SecondaryService, Contextualizable
{
private Logger m_system = null;
private File m_home = null;
private PrimaryService m_primary = null;
/**
* Supply of a logging channel to the component.
* @param logger the logging channel
* @avalon.logger name="system"
*/
public void enableLogging( Logger logger )
{
super.enableLogging( logger );
m_system = logger.getChildLogger( "system" );
}
/**
* Supply of the runtime context by the container.
* @param context the runtime context
* @avalon.entry key="home" type="java.io.File"
*/
public void contextualize( Context context ) throws ContextException
{
m_home = (File) context.get("home");
}
/**
* Supply of dependent services to this component by the container.
* @param manager the service manager
* @avalon.dependency type="PrimaryService" version="1.3" key="primary"
*/
public void service( ServiceManager manager ) throws ServiceException
{
m_primary = (PrimaryService) manager.lookup( "primary" );
m_system.info( "resolved primary service reference" );
}
}