@@ -7,9 +7,11 @@
*/
package org.apache.myrmidon.api;
import java.io.File;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
@@ -23,7 +25,7 @@ public abstract class AbstractTask
implements Task, Contextualizable, Initializable, Disposable
{
///Variable to hold context for use by sub-classes
private TaskContext m_context;
private TaskContext m_context;
/**
* Retrieve context from container.
@@ -46,7 +48,7 @@ public abstract class AbstractTask
}
/**
* Execute task.
* Execute task.
* This method is called to perform actual work associated with task.
* It is called after Task has been Configured and Initialized and before
* beig Disposed (If task implements appropriate interfaces).
@@ -75,4 +77,57 @@ public abstract class AbstractTask
{
return m_context;
}
protected final JavaVersion getJavaVersion()
{
return getContext().getJavaVersion();
}
protected final Object get( final Object key )
throws ContextException
{
return getContext().get( key );
}
//Will be made protected in the future
public final String getName()
{
return getContext().getName();
}
protected final File getBaseDirectory()
{
return getContext().getBaseDirectory();
}
protected final File resolveFile( final String filename )
throws TaskException
{
return getContext().resolveFile( filename );
}
protected final Object getProperty( final String name )
{
return getContext().getProperty( name );
}
protected final void setProperty( final String name, final Object value )
throws TaskException
{
getContext().setProperty( name, value );
}
protected final void setProperty( final String name,
final Object value,
final TaskContext.ScopeEnum scope )
throws TaskException
{
getContext().setProperty( name, value, scope );
}
protected final TaskContext createSubContext( final String name )
throws TaskException
{
return getContext().createSubContext( name );
}
}