commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rami Ojares" <rami.oja...@elisa.fi>
Subject [vfs] VfsTask
Date Mon, 21 Jun 2004 14:51:58 GMT
I have pronlems with VfsTask.
First of all I need to instantiate AntLogger in ant tasks
so AntLogger needs to be made public.
But that is not enough since I need to instantiate it also
in DataTypes (FileSet in particular).
Also resolveFile needs to be accessed from FileSet DataType.

Therefore I would propably need VfsDataType that would be very
similar to VfsTask. Which led me to wondering about FileSystemManager.

Now ant tasks instantiate the manager if they invoke resolveFile method.
And when the build completes the manager is closed.

When ant tasks call some components (like toolbox components) that are not related to ant
they have to open their own manager.

So I was wondering why not just use VFS class to get the manager also in ant tasks?

And make the AntLogger public and independent class like this:

/**
 * A commons-logging wrapper for Ant logging.
 */
public class AntLogger
    implements Log
{
    
    private ProjectComponent pc;
    
    public AntLogger(ProjectComponent pc) {
        this.pc = pc;
    }
    
    public void debug(final Object o)
    {
        pc.log(String.valueOf(o), Project.MSG_DEBUG);
    }

    public void debug(Object o, Throwable throwable)
    {
        debug(o);
    }

    public void error(Object o)
    {
        pc.log(String.valueOf(o), Project.MSG_ERR);
    }

    public void error(Object o, Throwable throwable)
    {
        error(o);
    }

    public void fatal(Object o)
    {
        pc.log(String.valueOf(o), Project.MSG_ERR);
    }

    public void fatal(Object o, Throwable throwable)
    {
        fatal(o);
    }

    public void info(Object o)
    {
        pc.log(String.valueOf(o), Project.MSG_INFO);
    }

    public void info(Object o, Throwable throwable)
    {
        info(o);
    }

    public void trace(Object o)
    {
    }

    public void trace(Object o, Throwable throwable)
    {
    }

    public void warn(Object o)
    {
        pc.log(String.valueOf(o), Project.MSG_WARN);
    }

    public void warn(Object o, Throwable throwable)
    {
        warn(o);
    }

    public boolean isDebugEnabled()
    {
        return true;
    }

    public boolean isErrorEnabled()
    {
        return true;
    }

    public boolean isFatalEnabled()
    {
        return true;
    }

    public boolean isInfoEnabled()
    {
        return true;
    }

    public boolean isTraceEnabled()
    {
        return false;
    }

    public boolean isWarnEnabled()
    {
        return true;
    }
}

Then I can instantiate AntLogger also from DataTypes.
And I can resolveFiles from DataTypes by getting a manager.

- rami

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message