From 78e258706ddda8eee2bfb6b71b673e33aa29d59f Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Tue, 5 Feb 2008 20:01:12 +0000 Subject: [PATCH] revert OPENJPA-401 in 1.0.x - shouldn't add a new flag in a service stream. git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@618762 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/jdbc/ant/MappingToolTask.java | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java index 3365a934f..0c9e95092 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/ant/MappingToolTask.java @@ -49,7 +49,6 @@ import org.apache.openjpa.util.MultiLoaderClassResolver; *
  • file
  • *
  • schemaFile
  • *
  • sqlFile
  • - *
  • tmpClassLoader
  • * Of these arguments, only action is required. */ public class MappingToolTask @@ -62,7 +61,6 @@ public class MappingToolTask protected String file = null; protected String schemaFile = null; protected String sqlFile = null; - protected boolean tmpClassLoader = true; /** * Set the enumerated MappingTool action type. @@ -177,28 +175,22 @@ public class MappingToolTask throws Exception { if (MappingTool.ACTION_IMPORT.equals(flags.action)) assertFiles(files); - ClassLoader toolLoader = (ClassLoader) AccessController - .doPrivileged(J2DoPrivHelper - .getClassLoaderAction(MappingTool.class)); - ClassLoader loader = toolLoader; - MultiLoaderClassResolver resolver = new MultiLoaderClassResolver(); - - if (tmpClassLoader) { - loader = (ClassLoader) AccessController.doPrivileged(J2DoPrivHelper - - .newTemporaryClassLoaderAction(getClassLoader())); - resolver.addClassLoader(loader); - } - resolver.addClassLoader(toolLoader); + ClassLoader loader = + (ClassLoader) AccessController.doPrivileged(J2DoPrivHelper + .newTemporaryClassLoaderAction(getClassLoader())); + if (flags.meta && MappingTool.ACTION_ADD.equals(flags.action)) flags.metaDataFile = Files.getFile(file, loader); else flags.mappingWriter = Files.getWriter(file, loader); - flags.schemaWriter = Files.getWriter(schemaFile, loader); flags.sqlWriter = Files.getWriter(sqlFile, loader); + MultiLoaderClassResolver resolver = new MultiLoaderClassResolver(); + resolver.addClassLoader((ClassLoader) AccessController.doPrivileged( + J2DoPrivHelper.getClassLoaderAction(MappingTool.class))); + resolver.addClassLoader(loader); JDBCConfiguration conf = (JDBCConfiguration) getConfiguration(); conf.setClassResolver(resolver); @@ -226,18 +218,5 @@ public class MappingToolTask return actions; } } - - /** - *

    - * Set whether a temporary ClassLoader should be used by the MappingTool. - * The default value is true - *

    - * - * @param tmpClassLoader - * Whether the temporary ClassLoader should be used. - */ - public void setTmpClassLoader(boolean tmpClassLoader) { - this.tmpClassLoader = tmpClassLoader; - } }