Browse Source

Convert Jspc to using TaskContext to log

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271770 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
18b9849780
10 changed files with 58 additions and 20 deletions
  1. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
  2. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java
  3. +10
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java
  4. +14
    -4
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java
  5. +2
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
  6. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
  7. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java
  8. +10
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java
  9. +14
    -4
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java
  10. +2
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java

+ 1
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java View File

@@ -383,7 +383,7 @@ public class JspC extends MatchingTask
if( compileList.size() > 0 )
{
CompilerAdapter adapter =
CompilerAdapterFactory.getCompiler( compiler.toString(), this );
CompilerAdapterFactory.getCompiler( compiler.toString(), getContext() );
getLogger().info( "Compiling " + compileList.size() +
" source file"
+ ( compileList.size() == 1 ? "" : "s" )


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.jsp.compilers;

import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC;

/**
@@ -23,9 +24,9 @@ import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
* jayglanville@home.com</a>
* @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a>
*/

public interface CompilerAdapter
{
void setTaskContext( TaskContext context );

/**
* Sets the compiler attributes, which are stored in the Jspc task.


+ 10
- 3
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java View File

@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers;

import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskContext;

/**
* Creates the necessary compiler adapter, given basic criteria.
@@ -18,7 +19,6 @@ import org.apache.myrmidon.api.TaskException;
*/
public class CompilerAdapterFactory
{

/**
* This is a singlton -- can't create instances!!
*/
@@ -39,12 +39,19 @@ public class CompilerAdapterFactory
*
* @param compilerType either the name of the desired compiler, or the full
* classname of the compiler's adapter.
* @param task a task to log through.
* @return The Compiler value
* @throws TaskException if the compiler type could not be resolved into a
* compiler adapter.
*/
public static CompilerAdapter getCompiler( String compilerType, AbstractTask task )
public static CompilerAdapter getCompiler( String compilerType, TaskContext context )
throws TaskException
{
final CompilerAdapter adapter = createAdapter( compilerType );
adapter.setTaskContext( context );
return adapter;
}

private static CompilerAdapter createAdapter( String compilerType )
throws TaskException
{
/*


+ 14
- 4
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java View File

@@ -10,7 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
import org.apache.tools.ant.types.Commandline;

@@ -21,10 +21,20 @@ import org.apache.tools.ant.types.Commandline;
* @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a>
*/
public abstract class DefaultCompilerAdapter
extends AbstractLogEnabled
implements CompilerAdapter
{
private JspC m_attributes;
private TaskContext m_taskContext;

public void setTaskContext( final TaskContext context )
{
m_taskContext = context;
}

protected final TaskContext getTaskContext()
{
return m_taskContext;
}

public void setJspc( final JspC attributes )
{
@@ -51,7 +61,7 @@ public abstract class DefaultCompilerAdapter
ArrayList compileList,
Commandline cmd )
{
getLogger().debug( "Compilation args: " + cmd.toString() );
getTaskContext().debug( "Compilation args: " + cmd.toString() );

StringBuffer niceSourceList = new StringBuffer( "File" );
if( compileList.size() != 1 )
@@ -70,7 +80,7 @@ public abstract class DefaultCompilerAdapter
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR );
}

getLogger().debug( niceSourceList.toString() );
getTaskContext().debug( niceSourceList.toString() );
}
}


+ 2
- 1
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.jsp.compilers;

import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
import org.apache.tools.ant.types.Argument;
@@ -28,7 +29,7 @@ public class JasperC
public boolean execute()
throws TaskException
{
getLogger().debug( "Using jasper compiler" );
getTaskContext().debug( "Using jasper compiler" );
Commandline cmd = setupJasperCommand();

try


+ 1
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java View File

@@ -383,7 +383,7 @@ public class JspC extends MatchingTask
if( compileList.size() > 0 )
{
CompilerAdapter adapter =
CompilerAdapterFactory.getCompiler( compiler.toString(), this );
CompilerAdapterFactory.getCompiler( compiler.toString(), getContext() );
getLogger().info( "Compiling " + compileList.size() +
" source file"
+ ( compileList.size() == 1 ? "" : "s" )


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.jsp.compilers;

import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC;

/**
@@ -23,9 +24,9 @@ import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
* jayglanville@home.com</a>
* @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a>
*/

public interface CompilerAdapter
{
void setTaskContext( TaskContext context );

/**
* Sets the compiler attributes, which are stored in the Jspc task.


+ 10
- 3
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java View File

@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers;

import org.apache.myrmidon.api.AbstractTask;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskContext;

/**
* Creates the necessary compiler adapter, given basic criteria.
@@ -18,7 +19,6 @@ import org.apache.myrmidon.api.TaskException;
*/
public class CompilerAdapterFactory
{

/**
* This is a singlton -- can't create instances!!
*/
@@ -39,12 +39,19 @@ public class CompilerAdapterFactory
*
* @param compilerType either the name of the desired compiler, or the full
* classname of the compiler's adapter.
* @param task a task to log through.
* @return The Compiler value
* @throws TaskException if the compiler type could not be resolved into a
* compiler adapter.
*/
public static CompilerAdapter getCompiler( String compilerType, AbstractTask task )
public static CompilerAdapter getCompiler( String compilerType, TaskContext context )
throws TaskException
{
final CompilerAdapter adapter = createAdapter( compilerType );
adapter.setTaskContext( context );
return adapter;
}

private static CompilerAdapter createAdapter( String compilerType )
throws TaskException
{
/*


+ 14
- 4
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java View File

@@ -10,7 +10,7 @@ package org.apache.tools.ant.taskdefs.optional.jsp.compilers;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.avalon.excalibur.util.StringUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
import org.apache.tools.ant.types.Commandline;

@@ -21,10 +21,20 @@ import org.apache.tools.ant.types.Commandline;
* @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a>
*/
public abstract class DefaultCompilerAdapter
extends AbstractLogEnabled
implements CompilerAdapter
{
private JspC m_attributes;
private TaskContext m_taskContext;

public void setTaskContext( final TaskContext context )
{
m_taskContext = context;
}

protected final TaskContext getTaskContext()
{
return m_taskContext;
}

public void setJspc( final JspC attributes )
{
@@ -51,7 +61,7 @@ public abstract class DefaultCompilerAdapter
ArrayList compileList,
Commandline cmd )
{
getLogger().debug( "Compilation args: " + cmd.toString() );
getTaskContext().debug( "Compilation args: " + cmd.toString() );

StringBuffer niceSourceList = new StringBuffer( "File" );
if( compileList.size() != 1 )
@@ -70,7 +80,7 @@ public abstract class DefaultCompilerAdapter
niceSourceList.append( " " + arg + StringUtil.LINE_SEPARATOR );
}

getLogger().debug( niceSourceList.toString() );
getTaskContext().debug( niceSourceList.toString() );
}
}


+ 2
- 1
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java View File

@@ -8,6 +8,7 @@
package org.apache.tools.ant.taskdefs.optional.jsp.compilers;

import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
import org.apache.tools.ant.types.Argument;
@@ -28,7 +29,7 @@ public class JasperC
public boolean execute()
throws TaskException
{
getLogger().debug( "Using jasper compiler" );
getTaskContext().debug( "Using jasper compiler" );
Commandline cmd = setupJasperCommand();

try


Loading…
Cancel
Save