[jbosstools-commits] JBoss Tools SVN: r22041 - in branches/hibernatetools-multiversion/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl and 21 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed May 12 12:34:04 EDT 2010


Author: vyemialyanchyk
Date: 2010-05-12 12:34:01 -0400 (Wed, 12 May 2010)
New Revision: 22041

Added:
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java
Removed:
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java
Modified:
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java
   branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6070 - fix bugs, fix with Hibernate 3.5

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -47,7 +47,11 @@
 import org.hibernate.mediator.x.Session;
 import org.hibernate.mediator.x.cfg.Configuration;
 import org.hibernate.mediator.x.cfg.ConfigurationFactory;
+import org.hibernate.mediator.x.cfg.JDBCMetaDataConfiguration;
 import org.hibernate.mediator.x.cfg.Settings;
+import org.hibernate.mediator.x.cfg.reveng.DefaultDatabaseCollector;
+import org.hibernate.mediator.x.cfg.reveng.DefaultReverseEngineeringStrategy;
+import org.hibernate.mediator.x.cfg.reveng.ReverseEngineeringStrategy;
 import org.hibernate.mediator.x.tool.ide.completion.HQLCodeAssist;
 import org.xml.sax.EntityResolver;
 
@@ -479,6 +483,32 @@
 			}
 		} );
 	}
+	
+	public ReverseEngineeringStrategy createDefReverseEngineeringStrategy() {
+		return (ReverseEngineeringStrategy)execute(new ExecutionContext.Command() {
+			public Object execute() {
+				return DefaultReverseEngineeringStrategy.newInstance();
+			}
+		} );
+	}
+	
+	public DefaultDatabaseCollector createDefaultDatabaseCollector() {
+		return (DefaultDatabaseCollector)execute(new ExecutionContext.Command() {
+			public Object execute() {
+				return DefaultDatabaseCollector.newInstance();
+			}
+		} );
+	}
+	
+	public JDBCMetaDataConfiguration createJDBCMetaDataConfiguration() {
+		return (JDBCMetaDataConfiguration)execute(new ExecutionContext.Command() {
+			public Object execute() {
+				ConfigurationFactory configStubFactory = new ConfigurationFactory(null);
+				final JDBCMetaDataConfiguration cfg = configStubFactory.createConfigurationJDBCMetaData();
+				return cfg;
+			}
+		} );
+	}
 
 	@SuppressWarnings("unchecked")
 	public Iterator<Throwable> doSchemaExport() {

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -120,7 +120,8 @@
 	   Exporter exporter = null;
 
 	   try {
-		   exporter = (Exporter) ReflectHelper.classForName( classname ).newInstance();
+		   Object obj = ReflectHelper.classForName( classname ).newInstance();
+		   exporter = org.hibernate.mediator.x.tool.hbm2x.ExporterFactory.createExporterStub(obj); 
 	   }
 	   catch (InstantiationException e) {
 		   throw new HibernateConsoleRuntimeException(HibernateConsoleMessages.ExporterDefinition_problem_creating_exporter_class + classname);

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -18,12 +18,11 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.dom4j.Attribute;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
-import org.dom4j.VisitorSupport;
-import org.dom4j.io.SAXReader;
+import org.dom4j.mediator.x.Attribute;
+import org.dom4j.mediator.x.Document;
+import org.dom4j.mediator.x.Element;
+import org.dom4j.mediator.x.Visitor;
+import org.dom4j.mediator.x.io.SAXReader;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.Assert;
@@ -51,7 +50,6 @@
 import org.hibernate.mediator.execution.ExecutionContext;
 import org.hibernate.mediator.stubs.util.OpenMappingUtilsEjb3;
 import org.hibernate.mediator.stubs.util.StringHelper;
-import org.hibernate.mediator.stubs.util.XMLHelper;
 import org.hibernate.mediator.x.mapping.Collection;
 import org.hibernate.mediator.x.mapping.Column;
 import org.hibernate.mediator.x.mapping.Component;
@@ -67,6 +65,7 @@
 import org.hibernate.mediator.x.mapping.ToOne;
 import org.hibernate.mediator.x.mapping.Value;
 import org.hibernate.mediator.x.tool.hbm2x.Cfg2HbmTool;
+import org.hibernate.mediator.x.util.XMLHelper;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 
@@ -328,7 +327,7 @@
 		return visitor.iterator();
 	}
 
-	private static class LVS extends VisitorSupport {
+	private static class LVS extends Visitor {
 		private String nodeName;
 		private String attrName;
 		private String attrValue;
@@ -395,15 +394,19 @@
 		}
 		try {
 			List<Throwable> errors = new ArrayList<Throwable>();
-			XMLHelper helper = new XMLHelper();
+			XMLHelper helper = XMLHelper.newInstance();
 			SAXReader saxReader = helper.createSAXReader(configXMLFile.getPath(), errors, entityResolver);
 			doc = saxReader.read(new InputSource( stream));
 			if (errors.size() != 0) {
     			HibernateConsolePlugin.getDefault().logErrorMessage("invalid configuration", (Throwable)null);	//$NON-NLS-1$
 			}
 		}
-		catch (DocumentException e) {
-			HibernateConsolePlugin.getDefault().logErrorMessage("Could not parse configuration", e);			//$NON-NLS-1$
+		catch (Exception e) {
+			if (e.getClass().getName().contains("DocumentException")) { //$NON-NLS-1$
+				HibernateConsolePlugin.getDefault().logErrorMessage("Could not parse configuration", e);			//$NON-NLS-1$
+			} else {
+				HibernateConsolePlugin.getDefault().logErrorMessage("Could not parse configuration", e);			//$NON-NLS-1$
+			}
 		}
 		finally {
 			try {

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -28,9 +28,8 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
-import org.dom4j.io.SAXReader;
+import org.dom4j.mediator.x.Element;
+import org.dom4j.mediator.x.io.SAXReader;
 import org.eclipse.core.internal.resources.File;
 import org.eclipse.core.internal.resources.ICoreConstants;
 import org.eclipse.core.internal.resources.ResourceInfo;
@@ -401,15 +400,19 @@
 			return new String[0];
 		}
 		InputStream is = null;
-		org.dom4j.Document doc = null;
+		org.dom4j.mediator.x.Document doc = null;
 		try {
 			is = file.getContents();
-			SAXReader saxReader = new SAXReader();
+			SAXReader saxReader = SAXReader.newInstance();
 			doc = saxReader.read(new InputSource(is));
 		} catch (CoreException e) {
 			HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
-		} catch (DocumentException e) {
-			HibernateConsolePlugin.getDefault().logErrorMessage("DocumentException: ", e); //$NON-NLS-1$
+		} catch (Exception e) {
+			if (e.getClass().getName().contains("DocumentException")) { //$NON-NLS-1$
+				HibernateConsolePlugin.getDefault().logErrorMessage("DocumentException: ", e); //$NON-NLS-1$
+			} else {
+				HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
+			}
 		} finally {
 			try {
 				if (is != null) is.close();

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -23,6 +23,9 @@
 
 import org.eclipse.ui.views.properties.IPropertyDescriptor;
 import org.eclipse.ui.views.properties.IPropertySource2;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.mediator.execution.ExecutionContext;
 import org.hibernate.mediator.x.Session;
 
 public class EntityPropertySource implements IPropertySource2
@@ -30,25 +33,45 @@
 	private Object reflectedObj;
 	private IPropertyDescriptor[] propertyDescriptors;
 	private final Session sessionStub;
+	private String consoleConfigName;
 
-	public EntityPropertySource(final Object obj, final Session sessionStub) {
+	public EntityPropertySource(final Object obj, final Session sessionStub, String consoleConfigName) {
 		this.sessionStub = sessionStub;
-		reflectedObj = obj;
+		this.reflectedObj = obj;
+		this.consoleConfigName = consoleConfigName;
 	}
 
 	public Object getEditableValue() {
 		return ""; //$NON-NLS-1$
 	}
 
+	public ConsoleConfiguration getConsoleConfig() {
+		final KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
+		ConsoleConfiguration consoleConfig = knownConfigurations.find(consoleConfigName);
+		return consoleConfig;
+	}
+
 	public IPropertyDescriptor[] getPropertyDescriptors() {
-		if (propertyDescriptors == null) {
-			propertyDescriptors = sessionStub.getPropertyDescriptors(reflectedObj);
+		if (propertyDescriptors == null && getConsoleConfig() != null) {
+			propertyDescriptors = (IPropertyDescriptor[])getConsoleConfig().execute(new ExecutionContext.Command() {
+				public Object execute() {
+					return sessionStub.getPropertyDescriptors(reflectedObj);
+				}
+			});
 		}
 		return propertyDescriptors;
 	}
 
-	public Object getPropertyValue(Object id) {
-		return sessionStub.getPropertyValue(reflectedObj, id);
+	public Object getPropertyValue(final Object id) {
+		Object val = null;
+		if (getConsoleConfig() != null) {
+			val = getConsoleConfig().execute(new ExecutionContext.Command() {
+				public Object execute() {
+					return sessionStub.getPropertyValue(reflectedObj, id);
+				}
+			});
+		}
+		return val;
 	}
 
 	public boolean isPropertySet(Object id) {

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/HibernatePropertySourceProvider.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -50,7 +50,7 @@
 				String consoleConfigName = qp.getConsoleConfigName();
 				if ((sessionStub.isOpen() && sessionStub.contains(obj)) || 
 						(obj != null && sessionStub.hasMetaData(obj))) {
-					res = new EntityPropertySource(obj, sessionStub);	
+					res = new EntityPropertySource(obj, sessionStub, consoleConfigName);	
 				}
 			}
 		}

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchema.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -22,7 +22,6 @@
 package org.hibernate.eclipse.console.workbench;
 
 import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mediator.x.cfg.reveng.DefaultReverseEngineeringStrategy;
 import org.hibernate.mediator.x.cfg.reveng.ReverseEngineeringStrategy;
 
 public class LazyDatabaseSchema {
@@ -31,7 +30,7 @@
 	private final ReverseEngineeringStrategy res;
 	
 	public LazyDatabaseSchema(ConsoleConfiguration ccfg) {
-		this(ccfg, DefaultReverseEngineeringStrategy.newInstance());
+		this(ccfg, ccfg.createDefReverseEngineeringStrategy());
 	}
 
 	public LazyDatabaseSchema(ConsoleConfiguration ccfg, ReverseEngineeringStrategy res) {

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/LazyDatabaseSchemaWorkbenchAdapter.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -53,9 +53,9 @@
 
 	public synchronized Object[] getChildren(Object o, final IProgressMonitor monitor) {
 		LazyDatabaseSchema dbs = getLazyDatabaseSchema( o );
-		final DefaultDatabaseCollector db = DefaultDatabaseCollector.newInstance();
 
 		ConsoleConfiguration consoleConfiguration = dbs.getConsoleConfiguration();
+		final DefaultDatabaseCollector db = consoleConfiguration.createDefaultDatabaseCollector();
 		try{
 			readDatabaseSchema(monitor, db, consoleConfiguration, dbs.getReverseEngineeringStrategy());
 

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLLexerRule.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -27,7 +27,7 @@
 import org.eclipse.jface.text.rules.ICharacterScanner;
 import org.eclipse.jface.text.rules.IRule;
 import org.eclipse.jface.text.rules.IToken;
-import org.hibernate.mediator.stubs.util.HqlBaseLexerStub;
+import org.hibernate.mediator.x.hql.antlr.HqlBaseLexer;
 
 public class HQLLexerRule implements IRule {
 
@@ -38,7 +38,7 @@
 	}
 
 	public IToken evaluate(final ICharacterScanner scanner) {
-		HqlBaseLexerStub lexer = HqlBaseLexerStub.newInstance(new Reader() {
+		HqlBaseLexer lexer = HqlBaseLexer.newInstance(new Reader() {
 
 			public void close() throws IOException {
 				// noop				

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -271,9 +271,7 @@
 				configuration = cc.buildWith( null, false );
 			}
 
-			// vitali: TODO: use execution context
-			ConfigurationFactory configStubFactory = new ConfigurationFactory(null);
-			final JDBCMetaDataConfiguration cfg = configStubFactory.createConfigurationJDBCMetaData();
+			final JDBCMetaDataConfiguration cfg = cc.createJDBCMetaDataConfiguration();
 			Properties properties = configuration.getProperties();
 			cfg.setProperties( properties );
 			cc.buildWith(cfg,false);

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -231,7 +231,7 @@
 				//}
 			//}
 
-			LazyDatabaseSchema lazyDatabaseSchema = new LazyDatabaseSchema(configuration, repository.getReverseEngineeringStrategy(DefaultReverseEngineeringStrategy.newInstance()));
+			LazyDatabaseSchema lazyDatabaseSchema = new LazyDatabaseSchema(configuration, repository.getReverseEngineeringStrategy(configuration.createDefReverseEngineeringStrategy()));
 
 			return lazyDatabaseSchema;
 		} catch(RuntimeException he) {

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/.classpath	2010-05-12 16:34:01 UTC (rev 22041)
@@ -3,42 +3,42 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 	<classpathentry kind="src" path="src"/>
+	<classpathentry exported="true" kind="lib" path="lib/hibernate/cglib-2.2.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/hibernate/log4j-1.2.15.jar"/>
+	<classpathentry kind="lib" path="lib/bsh-core-2.0b4.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/slf4j-log4j12-1.5.8.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/commons-logging-1.0.4.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/antlr-2.7.6.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="D:/Temp/_hibernate/hibernate-core-3.3.2.GA-sources.jar "/>
+	<classpathentry kind="lib" path="lib/hibernate/dom4j-1.6.1.jar" sourcepath="D:/Temp/_hibernate/dom4j-1.6.1-sources.jar "/>
+	<classpathentry kind="lib" path="lib/annotations/ejb3-persistence.jar"/>
+	<classpathentry kind="lib" path="lib/annotations/hibernate-annotations.jar"/>
+	<classpathentry kind="lib" path="lib/annotations/hibernate-commons-annotations.jar"/>
+	<classpathentry kind="lib" path="lib/annotations/hibernate-entitymanager.jar"/>
+	<classpathentry kind="lib" path="lib/annotations/hibernate-validator.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/asm-attrs.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/asm.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/asm-attrs.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/hibernate/dom4j-1.6.1.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/c3p0-0.9.1.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/commons-collections-3.1.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/concurrent-1.3.2.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/connector.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/ehcache-1.2.3.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/hibernate-jmx.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/jaas.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/javassist.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/jboss-cache.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/jboss-common.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/jboss-jmx.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/jboss-system.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/jdbc2_0-stdext.jar"/>
+	<classpathentry kind="lib" path="lib/hibernate/jgroups-2.2.8.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/jta.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/jaas.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/oscache-2.1.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/proxool-0.8.3.jar"/>
 	<classpathentry kind="lib" path="lib/hibernate/swarmcache-1.0rc2.jar"/>
-	<classpathentry kind="lib" path="lib/annotations/hibernate-annotations.jar" sourcepath="D:/Temp/_hibernate/hibernate-annotations-3.4.0.GA-sources.jar "/>
-	<classpathentry kind="lib" path="lib/hibernate/jgroups-2.2.8.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/antlr-2.7.6.jar"/>
-	<classpathentry kind="lib" path="lib/annotations/hibernate-entitymanager.jar" sourcepath="D:/Temp/_hibernate/hibernate-entitymanager-3.4.0.GA-sources.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/javassist.jar"/>
-	<classpathentry kind="lib" path="lib/annotations/hibernate-validator.jar" sourcepath="D:/Temp/_hibernate/hibernate-validator-3.1.0.GA-sources.jar "/>
-	<classpathentry kind="lib" path="lib/hibernate/log4j-1.2.15.jar" sourcepath="D:/Temp/_hibernate/log4j-1.2.15-sources.jar "/>
-	<classpathentry kind="lib" path="lib/hibernate/hibernate-jmx.jar" sourcepath="D:/Temp/_hibernate/hibernate-jmx-3.3.2.GA-sources.jar "/>
-	<classpathentry kind="lib" path="lib/hibernate/commons-collections-3.1.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar" sourcepath="D:/Temp/_hibernate/slf4j-api-1.5.8-sources.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/hibernate/cglib-2.2.jar" sourcepath="D:/Temp/_hibernate/cglib-src-2.2.jar"/>
-	<classpathentry kind="lib" path="lib/annotations/hibernate-commons-annotations.jar" sourcepath="D:/Temp/_hibernate/hibernate-commons-annotations-3.1.0.GA-sources.jar "/>
-	<classpathentry kind="lib" path="lib/annotations/ejb3-persistence.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/c3p0-0.9.1.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/commons-logging-1.0.4.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/concurrent-1.3.2.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/connector.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/ehcache-1.2.3.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/slf4j-log4j12-1.5.8.jar"/>
 	<classpathentry kind="lib" path="lib/tools/freemarker.jar"/>
-	<classpathentry kind="lib" path="lib/tools/hibernate-tools.jar" sourcepath="C:/RHDS/hibernate/branches/Branch_3_2/HibernateExt_without_changes"/>
+	<classpathentry kind="lib" path="lib/tools/hibernate-tools.jar"/>
 	<classpathentry kind="lib" path="lib/tools/jtidy-r8-20060801.jar"/>
-	<classpathentry kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="D:/Temp/_hibernate/hibernate-core-3.3.2.GA-sources.jar "/>
-	<classpathentry kind="lib" path="lib/bsh-core-2.0b4.jar" sourcepath="D:/Temp/_hibernate/bsh/src/BeanShell/src/bsh.zip"/>
 	<classpathentry kind="output" path="build/eclipse"/>
 </classpath>

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/META-INF/MANIFEST.MF	2010-05-12 16:34:01 UTC (rev 22041)
@@ -72,8 +72,9 @@
  org.hibernate.mediator.x.tool.hbm2x.pojo,
  org.hibernate.mediator.x.tool.ide.completion,
  org.hibernate.mediator.x.type,
- org.dom4j,
- org.dom4j.io,
+ org.hibernate.mediator.x.util,
+ org.dom4j.mediator.x,
+ org.dom4j.mediator.x.io,
  net.sf.cglib.core,
  net.sf.cglib.proxy,
  net.sf.cglib.reflect

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Attribute.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,25 @@
+package org.dom4j.mediator.x;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Attribute extends Node {
+
+	public static final String CL = "org.dom4j.Attribute"; //$NON-NLS-1$
+
+	protected Attribute(Object attribute) {
+		super(attribute, CL);
+	}
+
+	public static Attribute newInstance() {
+		return new Attribute(HObject.newInstance(CL));
+	}
+
+	public String getValue() {
+		return (String)invoke(mn());
+	}
+
+	@Override
+	public void accept(Visitor visitor) {
+		visitor.visit(this);
+	}
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Document.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,28 @@
+package org.dom4j.mediator.x;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Document extends Node {
+	public static final String CL = "org.dom4j.Document"; //$NON-NLS-1$
+
+	protected Document(Object document) {
+		super(document, CL);
+	}
+
+	public static Document newInstance() {
+		return new Document(HObject.newInstance(CL));
+	}
+
+	public static Document create(Object obj) {
+		return new Document(obj);
+	}
+	
+	public Element getRootElement() {
+		return new Element(invoke(mn()));
+	}
+
+	@Override
+	public void accept(Visitor visitor) {
+		visitor.visit(this);
+	}
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Element.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,73 @@
+package org.dom4j.mediator.x;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Element extends Node {
+
+	public static final String CL = "org.dom4j.Element"; //$NON-NLS-1$
+
+	protected Element(Object element) {
+		super(element, CL);
+	}
+
+	public static Element newInstance() {
+		return new Element(HObject.newInstance(CL));
+	}
+	
+	public Element element(String name) {
+		return new Element(invoke(mn(), name));
+	}
+
+	@SuppressWarnings("unchecked")
+	public List<Element> elements() {
+		List list = (List)invoke(mn());
+		Iterator it = list.iterator();
+		ArrayList<Element> al = new ArrayList<Element>();
+		while (it.hasNext()) {
+			Object obj = it.next();
+			if (obj != null) {
+				al.add(new Element(obj));
+			}
+		}
+		return al;
+	}
+
+	@SuppressWarnings("unchecked")
+	public List<Element> elements(String name) {
+		List list = (List)invoke(mn(), name);
+		Iterator it = list.iterator();
+		ArrayList<Element> al = new ArrayList<Element>();
+		while (it.hasNext()) {
+			Object obj = it.next();
+			if (obj != null) {
+				al.add(new Element(obj));
+			}
+		}
+		return al;
+	}
+	
+	public boolean remove(Node node) {
+		return (Boolean)invoke(mn(), node);
+	}
+
+	public String attributeValue(String name) {
+		return (String)invoke(mn(), name);
+	}
+	
+	public Attribute attribute(String name) {
+		return new Attribute(invoke(mn(), name));
+	}
+
+	public String getName() {
+		return (String)invoke(mn());
+	}
+
+	@Override
+	public void accept(Visitor visitor) {
+		visitor.visit(this);
+	}
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Node.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,27 @@
+package org.dom4j.mediator.x;
+
+import org.hibernate.mediator.base.HObject;
+
+public class Node extends HObject {
+
+	public static final String CL = "org.dom4j.Node"; //$NON-NLS-1$
+
+	protected Node(Object node) {
+		super(node, CL);
+	}
+
+	protected Node(Object node, String cn) {
+		super(node, cn);
+	}
+
+	public static Node newInstance() {
+		return new Node(HObject.newInstance(CL));
+	}
+
+	public Element getParent() {
+    	return new Element(invoke(mn()));
+    }
+
+	public void accept(Visitor visitor) {
+	}
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/Visitor.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,13 @@
+package org.dom4j.mediator.x;
+
+public abstract class Visitor {
+
+    public void visit(Document document) {
+    }
+
+    public void visit(Element node) {
+    }
+
+    public void visit(Attribute node) {
+    }
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/DOMWriter.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,20 @@
+package org.dom4j.mediator.x.io;
+
+import org.dom4j.mediator.x.Document;
+import org.hibernate.mediator.base.HObject;
+
+public class DOMWriter extends HObject {
+	public static final String CL = "org.dom4j.io.DOMWriter"; //$NON-NLS-1$
+
+	protected DOMWriter(Object saxReader) {
+		super(saxReader, CL);
+	}
+
+	public static DOMWriter newInstance() {
+		return new DOMWriter(HObject.newInstance(CL));
+	}
+
+	public org.w3c.dom.Document write(Document document) {
+		return (org.w3c.dom.Document)invoke(mn(), document);
+	}
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/dom4j/mediator/x/io/SAXReader.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,26 @@
+package org.dom4j.mediator.x.io;
+
+import org.dom4j.mediator.x.Document;
+import org.hibernate.mediator.base.HObject;
+import org.xml.sax.InputSource;
+
+public class SAXReader extends HObject {
+	public static final String CL = "org.dom4j.io.SAXReader"; //$NON-NLS-1$
+
+	protected SAXReader(Object saxReader) {
+		super(saxReader, CL);
+	}
+
+	public static SAXReader newInstance() {
+		return new SAXReader(HObject.newInstance(CL));
+	}
+
+	public static SAXReader create(Object obj) {
+		return new SAXReader(obj);
+	}
+
+    public Document read(InputSource in) {
+		Object obj = invoke(mn(), in);
+		return Document.create(obj);
+    }
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/ConfigHelper.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,23 @@
+package org.hibernate.mediator.stubs.util;
+
+import java.io.InputStream;
+
+import org.hibernate.mediator.base.HObject;
+
+public class ConfigHelper extends HObject {
+
+	public static final String CL = "org.hibernate.util.ConfigHelper"; //$NON-NLS-1$
+	
+	protected ConfigHelper(Object configHelper) {
+		super(configHelper, CL);
+	}
+
+	public static InputStream getResourceAsStream(String resource) {
+		return (InputStream)invokeStaticMethod(CL, "getResourceAsStream", resource); //$NON-NLS-1$
+	}
+	
+	public static InputStream getUserResourceAsStream(String resource) {
+		return (InputStream)invokeStaticMethod(CL, "getUserResourceAsStream", resource); //$NON-NLS-1$
+	}
+
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/DTDEntityResolver.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,115 @@
+package org.hibernate.mediator.stubs.util;
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors.  All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA  02110-1301  USA
+ *
+ */
+
+import java.io.InputStream;
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * An {@link EntityResolver} implementation which attempts to resolve
+ * various systemId URLs to local classpath lookups<ol>
+ * <li>Any systemId URL beginning with <tt>http://hibernate.sourceforge.net/</tt> is
+ * searched for as a classpath resource in the classloader which loaded the
+ * Hibernate classes.</li>
+ * <li>Any systemId URL using <tt>classpath</tt> as the scheme (i.e. starting
+ * with <tt>classpath://</tt> is searched for as a classpath resource using first
+ * the current thread context classloader and then the classloader which loaded
+ * the Hibernate classes.
+ * </ol>
+ * <p/>
+ * Any entity references which cannot be resolved in relation to the above
+ * rules result in returning null, which should force the SAX reader to
+ * handle the entity reference in its default manner.
+ *
+ * @author Markus Meissner
+ * @author Gavin King
+ * @author Steve Ebersole
+ */
+public class DTDEntityResolver implements EntityResolver, Serializable {
+
+	private static final Logger log = LoggerFactory.getLogger( DTDEntityResolver.class );
+
+	private static final String HIBERNATE_NAMESPACE = "http://hibernate.sourceforge.net/";
+	private static final String USER_NAMESPACE = "classpath://";
+
+	public InputSource resolveEntity(String publicId, String systemId) {
+		if ( systemId != null ) {
+			log.debug( "trying to resolve system-id [" + systemId + "]" );
+			if ( systemId.startsWith( HIBERNATE_NAMESPACE ) ) {
+				log.debug( "recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/" );
+				String path = "org/hibernate/" + systemId.substring( HIBERNATE_NAMESPACE.length() );
+				InputStream dtdStream = resolveInHibernateNamespace( path );
+				if ( dtdStream == null ) {
+					log.debug( "unable to locate [" + systemId + "] on classpath" );
+					if ( systemId.substring( HIBERNATE_NAMESPACE.length() ).indexOf( "2.0" ) > -1 ) {
+						log.error( "Don't use old DTDs, read the Hibernate 3.x Migration Guide!" );
+					}
+				}
+				else {
+					log.debug( "located [" + systemId + "] in classpath" );
+					InputSource source = new InputSource( dtdStream );
+					source.setPublicId( publicId );
+					source.setSystemId( systemId );
+					return source;
+				}
+			}
+			else if ( systemId.startsWith( USER_NAMESPACE ) ) {
+				log.debug( "recognized local namespace; attempting to resolve on classpath" );
+				String path = systemId.substring( USER_NAMESPACE.length() );
+				InputStream stream = resolveInLocalNamespace( path );
+				if ( stream == null ) {
+					log.debug( "unable to locate [" + systemId + "] on classpath" );
+				}
+				else {
+					log.debug( "located [" + systemId + "] in classpath" );
+					InputSource source = new InputSource( stream );
+					source.setPublicId( publicId );
+					source.setSystemId( systemId );
+					return source;
+				}
+			}
+		}
+		// use default behavior
+		return null;
+	}
+
+	protected InputStream resolveInHibernateNamespace(String path) {
+		return this.getClass().getClassLoader().getResourceAsStream( path );
+	}
+
+	protected InputStream resolveInLocalNamespace(String path) {
+		try {
+			return ConfigHelper.getUserResourceAsStream( path );
+		}
+		catch( Throwable t ) {
+			return null;
+		}
+	}
+}

Deleted: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/HqlBaseLexerStub.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,44 +0,0 @@
-package org.hibernate.mediator.stubs.util;
-
-import java.io.Reader;
-
-import org.hibernate.hql.antlr.HqlBaseLexer;
-import org.hibernate.mediator.HibernateConsoleRuntimeException;
-import org.hibernate.mediator.Messages;
-import org.hibernate.mediator.x.hql.antlr.HqlSqlTokenTypes;
-
-import antlr.Token;
-import antlr.TokenStreamException;
-
-public class HqlBaseLexerStub {
-	
-	protected HqlBaseLexer hqlBaseLexer;
-	
-	protected HqlBaseLexerStub(HqlBaseLexer hqlBaseLexer) {
-		if (hqlBaseLexer == null) {
-			throw new HibernateConsoleRuntimeException(Messages.Stub_create_null_stub_prohibit);
-		}
-		this.hqlBaseLexer = hqlBaseLexer;
-	}
-	
-	public static HqlBaseLexerStub newInstance(Reader in) {
-		return new HqlBaseLexerStub(new HqlBaseLexer(in));
-	}
-
-	private Token nextToken() {
-		try {
-			return hqlBaseLexer.nextToken();
-		} catch (TokenStreamException e) {
-			return null;
-		}
-	}
-	
-	public boolean isNextTokenIdent() {
-		Token token = nextToken();
-		if (token != null && token.getType() == HqlSqlTokenTypes.IDENT) {
-			return true;
-		} 
-		return false;
-	}
-
-}

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/StringHelper.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,9 +1,9 @@
 package org.hibernate.mediator.stubs.util;
 
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
 
-import org.hibernate.util.ArrayHelper;
-
 // org.hibernate.util.StringHelper
 public final class StringHelper {
 	public static final String WHITESPACE = " \n\r\f\t"; //$NON-NLS-1$
@@ -74,6 +74,17 @@
 				locations.add( new Integer( indx ) );
 			}
 		}
-		return ArrayHelper.toIntArray( locations );
+		return toIntArray(locations);
 	}
+
+	@SuppressWarnings("unchecked")
+	public static int[] toIntArray(Collection coll) {
+		Iterator iter = coll.iterator();
+		int[] arr = new int[ coll.size() ];
+		int i=0;
+		while (iter.hasNext()) {
+			arr[i++] = ((Integer)iter.next()).intValue();
+		}
+		return arr;
+	}
 }

Deleted: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/stubs/util/XMLHelper.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,45 +0,0 @@
-package org.hibernate.mediator.stubs.util;
-
-import java.util.List;
-
-import org.dom4j.io.SAXReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXParseException;
-
- at SuppressWarnings("unchecked")
-public class XMLHelper {
-
-	private static final Logger log = LoggerFactory.getLogger(XMLHelper.class);
-	private SAXReader saxReader;
-
-	public SAXReader createSAXReader(String file, List errorsList, EntityResolver entityResolver) {
-		if (saxReader==null) saxReader = new SAXReader();
-		saxReader.setEntityResolver(entityResolver);
-		saxReader.setErrorHandler(new ErrorLogger(file, errorsList));
-		saxReader.setMergeAdjacentText(true);
-		saxReader.setValidation(true);
-		return saxReader;
-	}
-
-	public static class ErrorLogger implements ErrorHandler {
-		private String file;
-		private List errors;
-		ErrorLogger(String file, List errors) {
-			this.file=file;
-			this.errors = errors;
-		}
-		public void error(SAXParseException error) {
-			log.error( "Error parsing XML: " + file + '(' + error.getLineNumber() + ") " + error.getMessage() ); //$NON-NLS-1$ //$NON-NLS-2$
-			errors.add(error);
-		}
-		public void fatalError(SAXParseException error) {
-			error(error);
-		}
-		public void warning(SAXParseException warn) {
-			log.warn( "Warning parsing XML: " + file + '(' + warn.getLineNumber() + ") " + warn.getMessage() ); //$NON-NLS-1$ //$NON-NLS-2$
-		}
-	}
-}

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/Query.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -23,7 +23,7 @@
 		for (int i = 0; i < returnTypes.length; i++) {
 			res[i] = TypeFactory.createTypeStub(returnTypes[i]);
 		}
-		return null;
+		return res;
 	}
 
 	public void setMaxResults(int intValue) {

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/ConfigurationFactory.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -15,9 +15,8 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.dom4j.DocumentException;
-import org.dom4j.Node;
-import org.dom4j.io.DOMWriter;
+import org.dom4j.mediator.x.Element;
+import org.dom4j.mediator.x.io.DOMWriter;
 import org.eclipse.datatools.connectivity.IConnectionProfile;
 import org.eclipse.datatools.connectivity.ProfileManager;
 import org.eclipse.osgi.util.NLS;
@@ -25,11 +24,11 @@
 import org.hibernate.mediator.Messages;
 import org.hibernate.mediator.preferences.ConsoleConfigurationPreferences;
 import org.hibernate.mediator.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.mediator.stubs.util.ConfigHelper;
 import org.hibernate.mediator.stubs.util.ReflectHelper;
 import org.hibernate.mediator.stubs.util.StringHelper;
 import org.hibernate.mediator.x.dialect.Dialect;
-import org.hibernate.util.ConfigHelper;
-import org.hibernate.util.XMLHelper;
+import org.hibernate.mediator.x.util.XMLHelper;
 import org.w3c.dom.Document;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
@@ -234,13 +233,12 @@
 		return localCfg;
 	}
 
-	@SuppressWarnings("unchecked")
 	private Configuration loadConfigurationXML(Configuration localCfg, boolean includeMappings,
 			EntityResolver entityResolver) {
 		File configXMLFile = prefs.getConfigXMLFile();
 		if (!includeMappings) {
-			org.dom4j.Document doc;
-			XMLHelper xmlHelper = new XMLHelper();
+			org.dom4j.mediator.x.Document doc;
+			XMLHelper xmlHelper = XMLHelper.newInstance();
 			InputStream stream = null;
 			String resourceName = "<unknown>"; //$NON-NLS-1$
 			if (configXMLFile != null) {
@@ -273,20 +271,26 @@
 									.get(0));
 				}
 
-				List<Node> list = doc.getRootElement()
+				List<Element> list = doc.getRootElement()
 						.element("session-factory").elements("mapping"); //$NON-NLS-1$ //$NON-NLS-2$
-				for (Node element : list) {
+				for (Element element : list) {
 					element.getParent().remove(element);
 				}
 
-				DOMWriter dw = new DOMWriter();
+				DOMWriter dw = DOMWriter.newInstance();
 				Document document = dw.write(doc);
 				return localCfg.configure(document);
 
-			} catch (DocumentException e) {
-				throw new HibernateConsoleRuntimeException(
-						Messages.ConsoleConfiguration_could_not_parse_configuration
-								+ resourceName, e);
+			} catch (Exception e) {
+				if (e.getClass().getName().contains("DocumentException")) { //$NON-NLS-1$
+					throw new HibernateConsoleRuntimeException(
+							Messages.ConsoleConfiguration_could_not_parse_configuration
+									+ resourceName, e);
+				} else {
+					throw new HibernateConsoleRuntimeException(
+							Messages.ConsoleConfiguration_could_not_parse_configuration
+									+ resourceName, e);
+				}
 			} finally {
 				try {
 					if (stream != null)
@@ -312,6 +316,8 @@
 		InputStream is = null;
 		try {
 			is = ConfigHelper.getResourceAsStream(resource);
+		} catch (HibernateConsoleRuntimeException hcre) {
+			// just ignore
 		} catch (RuntimeException he) {
 			// TODO: RuntimeException ? - find correct solution
 			if (he.getClass().getName().contains("HibernateException")) { //$NON-NLS-1$

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/cfg/reveng/ReverseEngineeringSettings.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -1,5 +1,6 @@
 package org.hibernate.mediator.x.cfg.reveng;
 
+import org.hibernate.mediator.HibernateConsoleRuntimeException;
 import org.hibernate.mediator.base.HObject;
 
 public class ReverseEngineeringSettings extends HObject {
@@ -10,7 +11,24 @@
 	}
 	
 	public static ReverseEngineeringSettings newInstance(ReverseEngineeringStrategy reverseEngineeringStrategy) {
-		return new ReverseEngineeringSettings(newInstance(CL, reverseEngineeringStrategy));
+		ReverseEngineeringSettings resNewInstance = null;
+		HibernateConsoleRuntimeException hcre = null;
+		try {
+			resNewInstance = new ReverseEngineeringSettings(newInstance(CL, reverseEngineeringStrategy));
+		} catch (HibernateConsoleRuntimeException hcre1) {
+			hcre = hcre1;
+		}
+		if (resNewInstance == null) { // hibernate 3.5 & new hibernate-tools
+			try {
+				resNewInstance = new ReverseEngineeringSettings(newInstance(CL));
+			} catch (HibernateConsoleRuntimeException hcre2) {
+				//hcre = hcre2;
+			}
+		}
+		if (resNewInstance == null) {
+			throw hcre;
+		}
+		return resNewInstance;
 	}
 
 	public ReverseEngineeringSettings setDefaultPackageName(String defaultPackageName) {
@@ -24,7 +42,11 @@
 	}
 
 	public ReverseEngineeringSettings setDetectOneToOne(boolean b) {
-		invoke(mn(), b);
+		try {
+			invoke(mn(), b);
+		} catch (HibernateConsoleRuntimeException hcre1) {
+			// hibernate 3.5 & new hibernate-tools
+		}
 		return this;
 	}
 

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/hql/antlr/HqlBaseLexer.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,40 @@
+package org.hibernate.mediator.x.hql.antlr;
+
+import java.io.Reader;
+
+import org.hibernate.mediator.base.HObject;
+import org.hibernate.mediator.x.hql.antlr.HqlSqlTokenTypes;
+
+import antlr.Token;
+
+public class HqlBaseLexer extends HObject {
+
+	public static final String CL = "org.hibernate.hql.antlr.HqlBaseLexer"; //$NON-NLS-1$
+	
+	public HqlBaseLexer(Object hqlBaseLexer) {
+		super(hqlBaseLexer, CL);
+	}
+
+	public static HqlBaseLexer newInstance(Reader in) {
+		return new HqlBaseLexer(HObject.newInstance(CL, in));
+	}
+
+	private Token nextToken() {
+		try {
+			return (Token)invoke(mn());
+		} catch (Exception e) {
+			//if (e.getClass().getName().contains("TokenStreamException")) { //$NON-NLS-1$
+			//}
+		}
+		return null;
+	}
+	
+	public boolean isNextTokenIdent() {
+		Token token = nextToken();
+		if (token != null && token.getType() == HqlSqlTokenTypes.IDENT) {
+			return true;
+		} 
+		return false;
+	}
+
+}

Modified: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java	2010-05-12 15:34:42 UTC (rev 22040)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/metadata/ClassMetadata.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -54,5 +54,4 @@
 	public Serializable getIdentifier(Object entity, EntityMode pojo) {
 		return (Serializable)invoke(mn(), entity, pojo);
 	}
-
 }

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/tool/hbm2x/ExporterFactory.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,17 @@
+package org.hibernate.mediator.x.tool.hbm2x;
+
+public class ExporterFactory {
+	@SuppressWarnings("unchecked")
+	public static Exporter createExporterStub(Object exporter) {
+		if (exporter == null) {
+			return null;
+		}
+		final Class cl = exporter.getClass();
+		if (0 == HibernateConfigurationExporter.CL.compareTo(cl.getName())) {
+			return new HibernateConfigurationExporter(exporter);
+		} else if (0 == GenericExporter.CL.compareTo(cl.getName())) {
+			return new GenericExporter(exporter);
+		}
+		return new GenericExporter(exporter);
+	}
+}

Added: branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java
===================================================================
--- branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java	                        (rev 0)
+++ branches/hibernatetools-multiversion/hibernatetools/plugins/org.hibernate.mediator/src/org/hibernate/mediator/x/util/XMLHelper.java	2010-05-12 16:34:01 UTC (rev 22041)
@@ -0,0 +1,28 @@
+package org.hibernate.mediator.x.util;
+
+import java.util.List;
+
+import org.dom4j.mediator.x.io.SAXReader;
+import org.hibernate.mediator.base.HObject;
+import org.xml.sax.EntityResolver;
+
+public class XMLHelper extends HObject {
+	
+	public static final String CL = "org.hibernate.util.XMLHelper"; //$NON-NLS-1$
+
+	public static final EntityResolver DEFAULT_DTD_RESOLVER = (EntityResolver)HObject.readStaticFieldValue(CL, "DEFAULT_DTD_RESOLVER"); //$NON-NLS-1$
+
+	protected XMLHelper(Object xmlHelper) {
+		super(xmlHelper, CL);
+	}
+
+	public static XMLHelper newInstance() {
+		return new XMLHelper(HObject.newInstance(CL));
+	}
+
+	@SuppressWarnings("unchecked")
+	public SAXReader createSAXReader(String file, List errorsList, EntityResolver entityResolver) {
+		Object obj = invoke(mn(), file, errorsList, entityResolver);
+		return SAXReader.create(obj);
+	}
+}



More information about the jbosstools-commits mailing list