PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277958 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2001-2002,2004 The Apache Software Foundation | |||
| * Copyright 2001-2002,2004-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -39,6 +39,7 @@ public interface RmicAdapter { | |||
| /** | |||
| * Sets the rmic attributes, which are stored in the Rmic task. | |||
| * @param attributes the rmic attributes to use | |||
| */ | |||
| void setRmic(Rmic attributes); | |||
| @@ -46,17 +47,20 @@ public interface RmicAdapter { | |||
| * Executes the task. | |||
| * | |||
| * @return has the compilation been successful | |||
| * @throws BuildException on error | |||
| */ | |||
| boolean execute() throws BuildException; | |||
| /** | |||
| * Maps source class files to the files generated by this rmic | |||
| * implementation. | |||
| * @return the filename mapper used by this implementation | |||
| */ | |||
| FileNameMapper getMapper(); | |||
| /** | |||
| * The CLASSPATH this rmic process will use. | |||
| * @return the classpaht this rmic process will use | |||
| */ | |||
| Path getClasspath(); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2001-2002,2004 The Apache Software Foundation | |||
| * Copyright 2001-2002,2004-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -26,9 +26,14 @@ import org.apache.tools.ant.Task; | |||
| * | |||
| * @since 1.4 | |||
| */ | |||
| public class RmicAdapterFactory { | |||
| public final class RmicAdapterFactory { | |||
| /** The error message to be used when the compiler cannot be found. */ | |||
| public static final String ERROR_UNKNOWN_COMPILER = "Cannot find the compiler or class: "; | |||
| /** The error message to be used when the class is not an rmic adapter. */ | |||
| public static final String ERROR_NOT_RMIC_ADAPTER = "Not an rmic adapter: "; | |||
| /** If the compiler has this name use a default compiler. */ | |||
| public static final String DEFAULT_COMPILER = "default"; | |||
| /** This is a singleton -- can't create instances!! */ | |||
| @@ -51,6 +56,7 @@ public class RmicAdapterFactory { | |||
| * @param rmicType either the name of the desired rmic, or the | |||
| * full classname of the rmic's adapter. | |||
| * @param task a task to log through. | |||
| * @return the compiler adapter | |||
| * @throws BuildException if the rmic type could not be resolved into | |||
| * a rmic adapter. | |||
| */ | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2001-2002,2004 The Apache Software Foundation | |||
| * Copyright 2001-2002,2004-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -47,12 +47,19 @@ public class SunRmic extends DefaultRmicAdapter { | |||
| * name of the executable | |||
| */ | |||
| public static final String RMIC_EXECUTABLE = "rmic"; | |||
| /** Error message to use with the sun rmic is not the classpath. */ | |||
| public static final String ERROR_NO_RMIC_ON_CLASSPATH = "Cannot use SUN rmic, as it is not " | |||
| + "available. A common solution is to " | |||
| + "set the environment variable " | |||
| + "JAVA_HOME or CLASSPATH."; | |||
| /** Error message to use when there is an error starting the sun rmic compiler */ | |||
| public static final String ERROR_RMIC_FAILED = "Error starting SUN rmic: "; | |||
| /** | |||
| * Run the rmic compiler. | |||
| * @return true if the compilation succeeded | |||
| * @throws BuildException on error | |||
| */ | |||
| public boolean execute() throws BuildException { | |||
| getRmic().log("Using SUN rmic compiler", Project.MSG_VERBOSE); | |||
| Commandline cmd = setupRmicCommand(); | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2001-2004 The Apache Software Foundation | |||
| * Copyright 2001-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -29,20 +29,32 @@ import org.apache.tools.ant.types.Commandline; | |||
| * @since Ant 1.4 | |||
| */ | |||
| public class WLRmic extends DefaultRmicAdapter { | |||
| /** The classname of the weblogic rmic */ | |||
| public static final String WLRMIC_CLASSNAME = "weblogic.rmic"; | |||
| /** | |||
| * the name of this adapter for users to select | |||
| */ | |||
| public static final String COMPILER_NAME = "weblogic"; | |||
| public static final String ERROR_NO_WLRMIC_ON_CLASSPATH = "Cannot use WebLogic rmic, as it is not " | |||
| + "available. A common solution is to " | |||
| + "set the environment variable " | |||
| + "CLASSPATH."; | |||
| /** The error string to use if not able to find the weblogic rmic */ | |||
| public static final String ERROR_NO_WLRMIC_ON_CLASSPATH = | |||
| "Cannot use WebLogic rmic, as it is not " | |||
| + "available. A common solution is to " | |||
| + "set the environment variable " | |||
| + "CLASSPATH."; | |||
| /** The error string to use if not able to start the weblogic rmic */ | |||
| public static final String ERROR_WLRMIC_FAILED = "Error starting WebLogic rmic: "; | |||
| /** The stub suffix */ | |||
| public static final String WL_RMI_STUB_SUFFIX = "_WLStub"; | |||
| /** The skeleton suffix */ | |||
| public static final String WL_RMI_SKEL_SUFFIX = "_WLSkel"; | |||
| /** | |||
| * Carry out the rmic compilation. | |||
| * @return true if the compilation succeeded | |||
| * @throws BuildException on error | |||
| */ | |||
| public boolean execute() throws BuildException { | |||
| getRmic().log("Using WebLogic rmic", Project.MSG_VERBOSE); | |||
| Commandline cmd = setupRmicCommand(new String[] {"-noexit"}); | |||
| @@ -80,6 +92,7 @@ public class WLRmic extends DefaultRmicAdapter { | |||
| /** | |||
| * Get the suffix for the rmic stub classes | |||
| * @return the stub suffix | |||
| */ | |||
| public String getStubClassSuffix() { | |||
| return WL_RMI_STUB_SUFFIX; | |||
| @@ -87,6 +100,7 @@ public class WLRmic extends DefaultRmicAdapter { | |||
| /** | |||
| * Get the suffix for the rmic skeleton classes | |||
| * @return the skeleton suffix | |||
| */ | |||
| public String getSkelClassSuffix() { | |||
| return WL_RMI_SKEL_SUFFIX; | |||