git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271768 13f79535-47bb-0310-9956-ffa450edef68master
@@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.rmic; | |||
import java.io.File; | |||
import java.util.ArrayList; | |||
import java.util.Random; | |||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.framework.FileNameMapper; | |||
@@ -30,7 +29,6 @@ import org.apache.tools.ant.util.FileUtils; | |||
* @author Takashi Okamoto <tokamoto@rd.nttdata.co.jp> | |||
*/ | |||
public abstract class DefaultRmicAdapter | |||
extends AbstractLogEnabled | |||
implements RmicAdapter | |||
{ | |||
@@ -39,8 +37,16 @@ public abstract class DefaultRmicAdapter | |||
private Rmic attributes; | |||
private FileNameMapper mapper; | |||
public DefaultRmicAdapter() | |||
private TaskContext m_taskContext; | |||
public void setTaskContext( final TaskContext context ) | |||
{ | |||
m_taskContext = context; | |||
} | |||
protected final TaskContext getTaskContext() | |||
{ | |||
return m_taskContext; | |||
} | |||
public void setRmic( Rmic attributes ) | |||
@@ -144,11 +150,11 @@ public abstract class DefaultRmicAdapter | |||
if( attributes.getIiop() ) | |||
{ | |||
getLogger().info( "IIOP has been turned on." ); | |||
getTaskContext().info( "IIOP has been turned on." ); | |||
cmd.addArgument( "-iiop" ); | |||
if( attributes.getIiopopts() != null ) | |||
{ | |||
getLogger().info( "IIOP Options: " + attributes.getIiopopts() ); | |||
getTaskContext().info( "IIOP Options: " + attributes.getIiopopts() ); | |||
cmd.addArgument( attributes.getIiopopts() ); | |||
} | |||
} | |||
@@ -156,11 +162,11 @@ public abstract class DefaultRmicAdapter | |||
if( attributes.getIdl() ) | |||
{ | |||
cmd.addArgument( "-idl" ); | |||
getLogger().info( "IDL has been turned on." ); | |||
getTaskContext().info( "IDL has been turned on." ); | |||
if( attributes.getIdlopts() != null ) | |||
{ | |||
cmd.addArgument( attributes.getIdlopts() ); | |||
getLogger().info( "IDL Options: " + attributes.getIdlopts() ); | |||
getTaskContext().info( "IDL Options: " + attributes.getIdlopts() ); | |||
} | |||
} | |||
@@ -220,7 +226,7 @@ public abstract class DefaultRmicAdapter | |||
{ | |||
ArrayList compileList = attributes.getCompileList(); | |||
getLogger().debug( "Compilation args: " + cmd.toString() ); | |||
getTaskContext().debug( "Compilation args: " + cmd.toString() ); | |||
StringBuffer niceSourceList = new StringBuffer( "File" ); | |||
if( compileList.size() != 1 ) | |||
@@ -236,7 +242,7 @@ public abstract class DefaultRmicAdapter | |||
niceSourceList.append( " " + arg ); | |||
} | |||
getLogger().debug( niceSourceList.toString() ); | |||
getTaskContext().debug( niceSourceList.toString() ); | |||
} | |||
/** | |||
@@ -385,20 +391,20 @@ public abstract class DefaultRmicAdapter | |||
{ | |||
final String message = "Unable to verify class " + classname | |||
+ ". It could not be found."; | |||
getLogger().warn( message ); | |||
getTaskContext().warn( message ); | |||
} | |||
catch( NoClassDefFoundError e ) | |||
{ | |||
final String message = "Unable to verify class " + classname | |||
+ ". It is not defined."; | |||
getLogger().warn( message ); | |||
getTaskContext().warn( message ); | |||
} | |||
catch( Throwable t ) | |||
{ | |||
final String message = "Unable to verify class " + classname | |||
+ ". Loading caused Exception: " | |||
+ t.getMessage(); | |||
getLogger().warn( message ); | |||
getTaskContext().warn( message ); | |||
} | |||
} | |||
return target; | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.rmic; | |||
import java.lang.reflect.Constructor; | |||
import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -23,7 +24,7 @@ public class KaffeRmic extends DefaultRmicAdapter | |||
public boolean execute() | |||
throws TaskException | |||
{ | |||
getLogger().debug( "Using Kaffe rmic" ); | |||
getTaskContext().debug( "Using Kaffe rmic" ); | |||
Commandline cmd = setupRmicCommand(); | |||
try | |||
@@ -479,7 +479,7 @@ public class Rmic extends MatchingTask | |||
} | |||
String compiler = getContext().getProperty( "build.rmic" ).toString(); | |||
RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler ); | |||
RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler, getContext() ); | |||
// now we need to populate the compiler adapter | |||
adapter.setRmic( this ); | |||
@@ -8,6 +8,7 @@ | |||
package org.apache.tools.ant.taskdefs.rmic; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.framework.FileNameMapper; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -23,9 +24,9 @@ import org.apache.tools.ant.types.Path; | |||
* @author <a href="mailto:tokamoto@rd.nttdata.co.jp">Takashi Okamoto</a> | |||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||
*/ | |||
public interface RmicAdapter | |||
{ | |||
void setTaskContext( TaskContext context ); | |||
/** | |||
* Sets the rmic attributes, which are stored in the Rmic task. | |||
@@ -8,6 +8,7 @@ | |||
package org.apache.tools.ant.taskdefs.rmic; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
/** | |||
* Creates the necessary rmic adapter, given basic criteria. | |||
@@ -42,8 +43,15 @@ public class RmicAdapterFactory | |||
* @throws TaskException if the rmic type could not be resolved into a rmic | |||
* adapter. | |||
*/ | |||
public static RmicAdapter getRmic( String rmicType ) | |||
public static RmicAdapter getRmic( final String rmicType, final TaskContext context ) | |||
throws TaskException | |||
{ | |||
final RmicAdapter adaptor = createAdaptor( rmicType ); | |||
adaptor.setTaskContext( context ); | |||
return adaptor; | |||
} | |||
private static RmicAdapter createAdaptor( String rmicType ) throws TaskException | |||
{ | |||
if( rmicType == null ) | |||
{ | |||
@@ -12,6 +12,7 @@ import java.io.OutputStream; | |||
import java.lang.reflect.Constructor; | |||
import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -25,7 +26,7 @@ public class SunRmic extends DefaultRmicAdapter | |||
public boolean execute() | |||
throws TaskException | |||
{ | |||
getLogger().debug( "Using SUN rmic compiler" ); | |||
getTaskContext().debug( "Using SUN rmic compiler" ); | |||
Commandline cmd = setupRmicCommand(); | |||
// Create an instance of the rmic, redirecting output to | |||
@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.rmic; | |||
import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -42,7 +43,7 @@ public class WLRmic extends DefaultRmicAdapter | |||
public boolean execute() | |||
throws TaskException | |||
{ | |||
getLogger().debug( "Using WebLogic rmic" ); | |||
getTaskContext().debug( "Using WebLogic rmic" ); | |||
Commandline cmd = setupRmicCommand( new String[]{"-noexit"} ); | |||
try | |||
@@ -10,7 +10,6 @@ package org.apache.tools.ant.taskdefs.rmic; | |||
import java.io.File; | |||
import java.util.ArrayList; | |||
import java.util.Random; | |||
import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.framework.FileNameMapper; | |||
@@ -30,7 +29,6 @@ import org.apache.tools.ant.util.FileUtils; | |||
* @author Takashi Okamoto <tokamoto@rd.nttdata.co.jp> | |||
*/ | |||
public abstract class DefaultRmicAdapter | |||
extends AbstractLogEnabled | |||
implements RmicAdapter | |||
{ | |||
@@ -39,8 +37,16 @@ public abstract class DefaultRmicAdapter | |||
private Rmic attributes; | |||
private FileNameMapper mapper; | |||
public DefaultRmicAdapter() | |||
private TaskContext m_taskContext; | |||
public void setTaskContext( final TaskContext context ) | |||
{ | |||
m_taskContext = context; | |||
} | |||
protected final TaskContext getTaskContext() | |||
{ | |||
return m_taskContext; | |||
} | |||
public void setRmic( Rmic attributes ) | |||
@@ -144,11 +150,11 @@ public abstract class DefaultRmicAdapter | |||
if( attributes.getIiop() ) | |||
{ | |||
getLogger().info( "IIOP has been turned on." ); | |||
getTaskContext().info( "IIOP has been turned on." ); | |||
cmd.addArgument( "-iiop" ); | |||
if( attributes.getIiopopts() != null ) | |||
{ | |||
getLogger().info( "IIOP Options: " + attributes.getIiopopts() ); | |||
getTaskContext().info( "IIOP Options: " + attributes.getIiopopts() ); | |||
cmd.addArgument( attributes.getIiopopts() ); | |||
} | |||
} | |||
@@ -156,11 +162,11 @@ public abstract class DefaultRmicAdapter | |||
if( attributes.getIdl() ) | |||
{ | |||
cmd.addArgument( "-idl" ); | |||
getLogger().info( "IDL has been turned on." ); | |||
getTaskContext().info( "IDL has been turned on." ); | |||
if( attributes.getIdlopts() != null ) | |||
{ | |||
cmd.addArgument( attributes.getIdlopts() ); | |||
getLogger().info( "IDL Options: " + attributes.getIdlopts() ); | |||
getTaskContext().info( "IDL Options: " + attributes.getIdlopts() ); | |||
} | |||
} | |||
@@ -220,7 +226,7 @@ public abstract class DefaultRmicAdapter | |||
{ | |||
ArrayList compileList = attributes.getCompileList(); | |||
getLogger().debug( "Compilation args: " + cmd.toString() ); | |||
getTaskContext().debug( "Compilation args: " + cmd.toString() ); | |||
StringBuffer niceSourceList = new StringBuffer( "File" ); | |||
if( compileList.size() != 1 ) | |||
@@ -236,7 +242,7 @@ public abstract class DefaultRmicAdapter | |||
niceSourceList.append( " " + arg ); | |||
} | |||
getLogger().debug( niceSourceList.toString() ); | |||
getTaskContext().debug( niceSourceList.toString() ); | |||
} | |||
/** | |||
@@ -385,20 +391,20 @@ public abstract class DefaultRmicAdapter | |||
{ | |||
final String message = "Unable to verify class " + classname | |||
+ ". It could not be found."; | |||
getLogger().warn( message ); | |||
getTaskContext().warn( message ); | |||
} | |||
catch( NoClassDefFoundError e ) | |||
{ | |||
final String message = "Unable to verify class " + classname | |||
+ ". It is not defined."; | |||
getLogger().warn( message ); | |||
getTaskContext().warn( message ); | |||
} | |||
catch( Throwable t ) | |||
{ | |||
final String message = "Unable to verify class " + classname | |||
+ ". Loading caused Exception: " | |||
+ t.getMessage(); | |||
getLogger().warn( message ); | |||
getTaskContext().warn( message ); | |||
} | |||
} | |||
return target; | |||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.rmic; | |||
import java.lang.reflect.Constructor; | |||
import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -23,7 +24,7 @@ public class KaffeRmic extends DefaultRmicAdapter | |||
public boolean execute() | |||
throws TaskException | |||
{ | |||
getLogger().debug( "Using Kaffe rmic" ); | |||
getTaskContext().debug( "Using Kaffe rmic" ); | |||
Commandline cmd = setupRmicCommand(); | |||
try | |||
@@ -479,7 +479,7 @@ public class Rmic extends MatchingTask | |||
} | |||
String compiler = getContext().getProperty( "build.rmic" ).toString(); | |||
RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler ); | |||
RmicAdapter adapter = RmicAdapterFactory.getRmic( compiler, getContext() ); | |||
// now we need to populate the compiler adapter | |||
adapter.setRmic( this ); | |||
@@ -8,6 +8,7 @@ | |||
package org.apache.tools.ant.taskdefs.rmic; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.framework.FileNameMapper; | |||
import org.apache.tools.ant.types.Path; | |||
@@ -23,9 +24,9 @@ import org.apache.tools.ant.types.Path; | |||
* @author <a href="mailto:tokamoto@rd.nttdata.co.jp">Takashi Okamoto</a> | |||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||
*/ | |||
public interface RmicAdapter | |||
{ | |||
void setTaskContext( TaskContext context ); | |||
/** | |||
* Sets the rmic attributes, which are stored in the Rmic task. | |||
@@ -8,6 +8,7 @@ | |||
package org.apache.tools.ant.taskdefs.rmic; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
/** | |||
* Creates the necessary rmic adapter, given basic criteria. | |||
@@ -42,8 +43,15 @@ public class RmicAdapterFactory | |||
* @throws TaskException if the rmic type could not be resolved into a rmic | |||
* adapter. | |||
*/ | |||
public static RmicAdapter getRmic( String rmicType ) | |||
public static RmicAdapter getRmic( final String rmicType, final TaskContext context ) | |||
throws TaskException | |||
{ | |||
final RmicAdapter adaptor = createAdaptor( rmicType ); | |||
adaptor.setTaskContext( context ); | |||
return adaptor; | |||
} | |||
private static RmicAdapter createAdaptor( String rmicType ) throws TaskException | |||
{ | |||
if( rmicType == null ) | |||
{ | |||
@@ -12,6 +12,7 @@ import java.io.OutputStream; | |||
import java.lang.reflect.Constructor; | |||
import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -25,7 +26,7 @@ public class SunRmic extends DefaultRmicAdapter | |||
public boolean execute() | |||
throws TaskException | |||
{ | |||
getLogger().debug( "Using SUN rmic compiler" ); | |||
getTaskContext().debug( "Using SUN rmic compiler" ); | |||
Commandline cmd = setupRmicCommand(); | |||
// Create an instance of the rmic, redirecting output to | |||
@@ -9,6 +9,7 @@ package org.apache.tools.ant.taskdefs.rmic; | |||
import java.lang.reflect.Method; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.tools.ant.types.Commandline; | |||
/** | |||
@@ -42,7 +43,7 @@ public class WLRmic extends DefaultRmicAdapter | |||
public boolean execute() | |||
throws TaskException | |||
{ | |||
getLogger().debug( "Using WebLogic rmic" ); | |||
getTaskContext().debug( "Using WebLogic rmic" ); | |||
Commandline cmd = setupRmicCommand( new String[]{"-noexit"} ); | |||
try | |||