Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Apache Ant Source Code Files
Apache Ant Source Code Files are inside the Apache Ant source package file
like apache-ant-1.10.10-src.zip.
Unzip the source package file and go to the "src/main" sub-directory,
you will see source code files.
Here is the list of Java source code files of the Apache Ant 1.10.10 in \Users\fyicenter\apache-ant-1.10.10\src\main:
✍: FYIcenter.com
⏎ org/apache/tools/ant/util/ScriptRunnerCreator.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.tools.ant.util;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.MagicNames;
import org.apache.tools.ant.Project;
/**
* This is a helper class used by ScriptRunnerHelper to
* create a ScriptRunner based on a classloader and on a language.
*/
public class ScriptRunnerCreator {
private static final String AUTO = "auto";
private static final String UTIL_OPT = MagicNames.ANT_CORE_PACKAGE + ".util.optional";
private static final String BSF = "bsf";
private static final String BSF_PACK = "org.apache.bsf";
private static final String BSF_MANAGER = BSF_PACK + ".BSFManager";
private static final String BSF_RUNNER = UTIL_OPT + ".ScriptRunner";
private static final String JAVAX = "javax";
private static final String JAVAX_MANAGER = "javax.script.ScriptEngineManager";
private static final String JAVAX_RUNNER = UTIL_OPT + ".JavaxScriptRunner";
private Project project;
private String manager;
private String language;
private ClassLoader scriptLoader = null;
/**
* Constructor for creator.
* @param project the current project.
*/
public ScriptRunnerCreator(Project project) {
this.project = project;
}
/**
* Create a ScriptRunner.
* @param manager the script manager ("auto" | "bsf" | "javax")
* @param language the language.
* @param classLoader the classloader to use
* @return the created script runner.
* @throws BuildException if unable to create the ScriptRunner.
*/
public synchronized ScriptRunnerBase createRunner(
String manager, String language, ClassLoader classLoader) {
this.manager = manager;
this.language = language;
this.scriptLoader = classLoader;
if (language == null) {
throw new BuildException("script language must be specified");
}
if (!manager.equals(AUTO) && !manager.equals(JAVAX) && !manager.equals(BSF)) {
throw new BuildException("Unsupported language prefix " + manager);
}
// Check for bsf first then javax
// This version does not check if the scriptManager
// supports the language.
ScriptRunnerBase ret = null;
ret = createRunner(BSF, BSF_MANAGER, BSF_RUNNER);
if (ret == null) {
ret = createRunner(JAVAX, JAVAX_MANAGER, JAVAX_RUNNER);
}
if (ret != null) {
return ret;
}
if (JAVAX.equals(manager)) {
throw new BuildException(
"Unable to load the script engine manager " + "(" + JAVAX_MANAGER + ")");
}
if (BSF.equals(manager)) {
throw new BuildException(
"Unable to load the BSF script engine manager " + "(" + BSF_MANAGER + ")");
}
throw new BuildException("Unable to load a script engine manager "
+ "(" + BSF_MANAGER + " or " + JAVAX_MANAGER + ")");
}
/**
* Create a script runner if the scriptManager matches the passed
* in manager.
* This checks if the script manager exists in the scriptLoader
* classloader and if so it creates and returns the script runner.
* @param checkManager check if the manager matches this value.
* @param managerClass the name of the script manager class.
* @param runnerClass the name of ant's script runner for this manager.
* @return the script runner class.
* @throws BuildException if there is a problem creating the runner class.
*/
private ScriptRunnerBase createRunner(
String checkManager, String managerClass, String runnerClass) {
ScriptRunnerBase runner = null;
if (!manager.equals(AUTO) && !manager.equals(checkManager)) {
return null;
}
if (managerClass.equals(BSF_MANAGER)) {
if (scriptLoader.getResource(LoaderUtils.classNameToResource(managerClass)) == null) {
return null;
}
new ScriptFixBSFPath().fixClassLoader(scriptLoader, language);
} else {
try {
Class.forName(managerClass, true, scriptLoader);
} catch (Exception ex) {
return null;
}
}
try {
runner = (ScriptRunnerBase) Class.forName(
runnerClass, true, scriptLoader).getDeclaredConstructor().newInstance();
runner.setProject(project);
} catch (Exception ex) {
throw ReflectUtil.toBuildException(ex);
}
runner.setLanguage(language);
runner.setScriptClassLoader(scriptLoader);
return runner;
}
}
⏎ org/apache/tools/ant/util/ScriptRunnerCreator.java
Or download all of them as a single archive file:
File name: apache-ant-1.10.10-fyi.zip File size: 2392938 bytes Release date: 2021-04-17 Download
⇐ Download Apache Ant Source Package
2021-07-10, ≈1543🔥, 0💬
Popular Posts:
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...
commons-io-2.6-sources.j aris the source JAR file for Apache Commons IO 2.6, which is a library of u...
JSP(tm) Standard Tag Library 1.0 implementation - Jakarta Taglibs hosts the Standard Taglib 1.0, an ...
maven-core-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Core module. Apache Maven is a software ...
How to download and install JDK (Java Development Kit) 1.4? If you want to write Java applications, ...