Author: dgeraskov
Date: 2011-11-21 16:58:54 -0500 (Mon, 21 Nov 2011)
New Revision: 36512
Added:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ArtifactCollectorImpl.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ArrayHelper.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ReflectHelper.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/StringHelper.java
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/TableFilterView.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/HibernateWorkbenchHelper.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/JavaCompletionProcessor.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyAssociationViewAdapter.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTab.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/ConsoleConfigNamePart.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/JavaTypeHandler.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigClassLoader.java
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
Log:
Do not use hibernate utils classes. This will reduce dependency on hibernate jar
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2011-11-21
21:58:54 UTC (rev 36512)
@@ -15,7 +15,8 @@
org.hibernate.eclipse,
org.hibernate.eclipse.launch,
org.hibernate.eclipse.logging,
- org.hibernate.eclipse.logging.xpl
+ org.hibernate.eclipse.logging.xpl,
+ org.hibernate.util.xpl
Require-Bundle: org.hibernate.eclipse.libs;bundle-version="1.0.0",
org.eclipse.core.runtime,
org.eclipse.ui.console,
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -55,8 +55,8 @@
import org.hibernate.dialect.resolver.DialectFactory;
import org.hibernate.eclipse.libs.FakeDelegatingDriver;
import org.hibernate.util.ConfigHelper;
-import org.hibernate.util.ReflectHelper;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.ReflectHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.hibernate.util.XMLHelper;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -25,7 +25,7 @@
import org.eclipse.core.runtime.Path;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import
org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
/**
* XML document part creation factory,
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigClassLoader.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigClassLoader.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigClassLoader.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -22,7 +22,7 @@
import java.util.Vector;
import java.util.jar.JarFile;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.util.xpl.ReflectHelper;
/**
* Workaround for jdk disgrace with open jar files & native libs,
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/AbstractConsoleConfigurationPreferences.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -28,7 +28,7 @@
import org.hibernate.console.ConsoleMessages;
import org.hibernate.console.HibernateConsoleRuntimeException;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Added:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ArrayHelper.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ArrayHelper.java
(rev 0)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ArrayHelper.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -0,0 +1,372 @@
+/*
+ * 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
+ *
+ */
+package org.hibernate.util.xpl;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.LockMode;
+import org.hibernate.LockOptions;
+import org.hibernate.type.Type;
+
+public final class ArrayHelper {
+
+ /*public static boolean contains(Object[] array, Object object) {
+ for ( int i=0; i<array.length; i++ ) {
+ if ( array[i].equals(object) ) return true;
+ }
+ return false;
+ }*/
+
+ public static int indexOf(Object[] array, Object object) {
+ for ( int i=0; i<array.length; i++ ) {
+ if ( array[i].equals(object) ) return i;
+ }
+ return -1;
+ }
+
+ /*public static Object[] clone(Class elementClass, Object[] array) {
+ Object[] result = (Object[]) Array.newInstance( elementClass, array.length );
+ System.arraycopy(array, 0, result, 0, array.length);
+ return result;
+ }*/
+
+ public static String[] toStringArray(Object[] objects) {
+ int length=objects.length;
+ String[] result = new String[length];
+ for (int i=0; i<length; i++) {
+ result[i] = objects[i].toString();
+ }
+ return result;
+ }
+
+ public static String[] fillArray(String value, int length) {
+ String[] result = new String[length];
+ Arrays.fill(result, value);
+ return result;
+ }
+
+ public static int[] fillArray(int value, int length) {
+ int[] result = new int[length];
+ Arrays.fill(result, value);
+ return result;
+ }
+
+ public static LockMode[] fillArray(LockMode lockMode, int length) {
+ LockMode[] array = new LockMode[length];
+ Arrays.fill(array, lockMode);
+ return array;
+ }
+
+ public static LockOptions[] fillArray(LockOptions lockOptions, int length) {
+ LockOptions[] array = new LockOptions[length];
+ Arrays.fill(array, lockOptions);
+ return array;
+ }
+
+ public static String[] toStringArray(Collection coll) {
+ return (String[]) coll.toArray( new String[coll.size()] );
+ }
+
+ public static String[][] to2DStringArray(Collection coll) {
+ return (String[][]) coll.toArray( new String[ coll.size() ][] );
+ }
+
+ public static int[][] to2DIntArray(Collection coll) {
+ return (int[][]) coll.toArray( new int[ coll.size() ][] );
+ }
+
+ public static Type[] toTypeArray(Collection coll) {
+ return (Type[]) coll.toArray( new Type[coll.size()] );
+ }
+
+ 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;
+ }
+
+ public static boolean[] toBooleanArray(Collection coll) {
+ Iterator iter = coll.iterator();
+ boolean[] arr = new boolean[ coll.size() ];
+ int i=0;
+ while( iter.hasNext() ) {
+ arr[i++] = ( (Boolean) iter.next() ).booleanValue();
+ }
+ return arr;
+ }
+
+ public static Object[] typecast(Object[] array, Object[] to) {
+ return java.util.Arrays.asList(array).toArray(to);
+ }
+
+ //Arrays.asList doesn't do primitive arrays
+ public static List toList(Object array) {
+ if ( array instanceof Object[] ) return Arrays.asList( (Object[]) array ); //faster?
+ int size = Array.getLength(array);
+ ArrayList list = new ArrayList(size);
+ for (int i=0; i<size; i++) {
+ list.add( Array.get(array, i) );
+ }
+ return list;
+ }
+
+ public static String[] slice(String[] strings, int begin, int length) {
+ String[] result = new String[length];
+ System.arraycopy( strings, begin, result, 0, length );
+ return result;
+ }
+
+ public static Object[] slice(Object[] objects, int begin, int length) {
+ Object[] result = new Object[length];
+ System.arraycopy( objects, begin, result, 0, length );
+ return result;
+ }
+
+ public static List toList(Iterator iter) {
+ List list = new ArrayList();
+ while ( iter.hasNext() ) {
+ list.add( iter.next() );
+ }
+ return list;
+ }
+
+ public static String[] join(String[] x, String[] y) {
+ String[] result = new String[ x.length + y.length ];
+ System.arraycopy( x, 0, result, 0, x.length );
+ System.arraycopy( y, 0, result, x.length, y.length );
+ return result;
+ }
+
+ public static String[] join(String[] x, String[] y, boolean[] use) {
+ String[] result = new String[ x.length + countTrue(use) ];
+ System.arraycopy( x, 0, result, 0, x.length );
+ int k = x.length;
+ for ( int i=0; i<y.length; i++ ) {
+ if ( use[i] ) {
+ result[k++] = y[i];
+ }
+ }
+ return result;
+ }
+
+ public static int[] join(int[] x, int[] y) {
+ int[] result = new int[ x.length + y.length ];
+ System.arraycopy( x, 0, result, 0, x.length );
+ System.arraycopy( y, 0, result, x.length, y.length );
+ return result;
+ }
+
+ public static final boolean[] TRUE = { true };
+ public static final boolean[] FALSE = { false };
+
+ private ArrayHelper() {}
+
+ public static String toString( Object[] array ) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[");
+ for (int i = 0; i < array.length; i++) {
+ sb.append( array[i] );
+ if( i<array.length-1 ) sb.append(",");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+
+ public static boolean isAllNegative(int[] array) {
+ for ( int i=0; i<array.length; i++ ) {
+ if ( array[i] >=0 ) return false;
+ }
+ return true;
+ }
+
+ public static boolean isAllTrue(boolean[] array) {
+ for ( int i=0; i<array.length; i++ ) {
+ if ( !array[i] ) return false;
+ }
+ return true;
+ }
+
+ public static int countTrue(boolean[] array) {
+ int result=0;
+ for ( int i=0; i<array.length; i++ ) {
+ if ( array[i] ) result++;
+ }
+ return result;
+ }
+
+ /*public static int countFalse(boolean[] array) {
+ int result=0;
+ for ( int i=0; i<array.length; i++ ) {
+ if ( !array[i] ) result++;
+ }
+ return result;
+ }*/
+
+ public static boolean isAllFalse(boolean[] array) {
+ for ( int i=0; i<array.length; i++ ) {
+ if ( array[i] ) return false;
+ }
+ return true;
+ }
+
+ public static void addAll(Collection collection, Object[] array) {
+ collection.addAll( Arrays.asList( array ) );
+ }
+
+ public static final String[] EMPTY_STRING_ARRAY = {};
+ public static final int[] EMPTY_INT_ARRAY = {};
+ public static final boolean[] EMPTY_BOOLEAN_ARRAY = {};
+ public static final Class[] EMPTY_CLASS_ARRAY = {};
+ public static final Object[] EMPTY_OBJECT_ARRAY = {};
+ public static final Type[] EMPTY_TYPE_ARRAY = {};
+
+ public static int[] getBatchSizes(int maxBatchSize) {
+ int batchSize = maxBatchSize;
+ int n=1;
+ while ( batchSize>1 ) {
+ batchSize = getNextBatchSize(batchSize);
+ n++;
+ }
+ int[] result = new int[n];
+ batchSize = maxBatchSize;
+ for ( int i=0; i<n; i++ ) {
+ result[i] = batchSize;
+ batchSize = getNextBatchSize(batchSize);
+ }
+ return result;
+ }
+
+ private static int getNextBatchSize(int batchSize) {
+ if (batchSize<=10) {
+ return batchSize-1; //allow 9,8,7,6,5,4,3,2,1
+ }
+ else if (batchSize/2 < 10) {
+ return 10;
+ }
+ else {
+ return batchSize / 2;
+ }
+ }
+
+ private static int SEED = 23;
+ private static int PRIME_NUMER = 37;
+
+ /**
+ * calculate the array hash (only the first level)
+ */
+ public static int hash(Object[] array) {
+ int length = array.length;
+ int seed = SEED;
+ for (int index = 0 ; index < length ; index++) {
+ seed = hash( seed, array[index] == null ? 0 : array[index].hashCode() );
+ }
+ return seed;
+ }
+
+ /**
+ * calculate the array hash (only the first level)
+ */
+ public static int hash(char[] array) {
+ int length = array.length;
+ int seed = SEED;
+ for (int index = 0 ; index < length ; index++) {
+ seed = hash( seed, (int) array[index] ) ;
+ }
+ return seed;
+ }
+
+ /**
+ * calculate the array hash (only the first level)
+ */
+ public static int hash(byte[] bytes) {
+ int length = bytes.length;
+ int seed = SEED;
+ for (int index = 0 ; index < length ; index++) {
+ seed = hash( seed, (int) bytes[index] ) ;
+ }
+ return seed;
+ }
+
+ private static int hash(int seed, int i) {
+ return PRIME_NUMER * seed + i;
+ }
+
+ /**
+ * Compare 2 arrays only at the first level
+ */
+ public static boolean isEquals(Object[] o1, Object[] o2) {
+ if (o1 == o2) return true;
+ if (o1 == null || o2 == null) return false;
+ int length = o1.length;
+ if (length != o2.length) return false;
+ for (int index = 0 ; index < length ; index++) {
+ if ( ! o1[index].equals( o2[index] ) ) return false;
+ }
+ return true;
+ }
+
+ /**
+ * Compare 2 arrays only at the first level
+ */
+ public static boolean isEquals(char[] o1, char[] o2) {
+ if (o1 == o2) return true;
+ if (o1 == null || o2 == null) return false;
+ int length = o1.length;
+ if (length != o2.length) return false;
+ for (int index = 0 ; index < length ; index++) {
+ if ( ! ( o1[index] == o2[index] ) ) return false;
+ }
+ return true;
+ }
+
+ /**
+ * Compare 2 arrays only at the first level
+ */
+ public static boolean isEquals(byte[] b1, byte[] b2) {
+ if (b1 == b2) return true;
+ if (b1 == null || b2 == null) return false;
+ int length = b1.length;
+ if (length != b2.length) return false;
+ for (int index = 0 ; index < length ; index++) {
+ if ( ! ( b1[index] == b2[index] ) ) return false;
+ }
+ return true;
+ }
+}
+
+
+
+
+
+
Added:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ReflectHelper.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ReflectHelper.java
(rev 0)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/ReflectHelper.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -0,0 +1,372 @@
+/*
+ * 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
+ *
+ */
+package org.hibernate.util.xpl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.hibernate.AssertionFailure;
+import org.hibernate.MappingException;
+import org.hibernate.PropertyNotFoundException;
+import org.hibernate.property.BasicPropertyAccessor;
+import org.hibernate.property.DirectPropertyAccessor;
+import org.hibernate.property.Getter;
+import org.hibernate.property.PropertyAccessor;
+import org.hibernate.type.PrimitiveType;
+import org.hibernate.type.Type;
+
+/**
+ * Utility class for various reflection operations.
+ *
+ * @author Gavin King
+ * @author Steve Ebersole
+ */
+public final class ReflectHelper {
+
+ //TODO: this dependency is kinda Bad
+ private static final PropertyAccessor BASIC_PROPERTY_ACCESSOR = new
BasicPropertyAccessor();
+ private static final PropertyAccessor DIRECT_PROPERTY_ACCESSOR = new
DirectPropertyAccessor();
+
+ public static final Class[] NO_PARAM_SIGNATURE = new Class[0];
+ public static final Object[] NO_PARAMS = new Object[0];
+
+ public static final Class[] SINGLE_OBJECT_PARAM_SIGNATURE = new Class[] { Object.class
};
+
+ private static final Method OBJECT_EQUALS;
+ private static final Method OBJECT_HASHCODE;
+
+ static {
+ Method eq;
+ Method hash;
+ try {
+ eq = extractEqualsMethod( Object.class );
+ hash = extractHashCodeMethod( Object.class );
+ }
+ catch ( Exception e ) {
+ throw new AssertionFailure( "Could not find Object.equals() or
Object.hashCode()", e );
+ }
+ OBJECT_EQUALS = eq;
+ OBJECT_HASHCODE = hash;
+ }
+
+ /**
+ * Disallow instantiation of ReflectHelper.
+ */
+ private ReflectHelper() {
+ }
+
+ /**
+ * Encapsulation of getting hold of a class's {@link Object#equals equals} method.
+ *
+ * @param clazz The class from which to extract the equals method.
+ * @return The equals method reference
+ * @throws NoSuchMethodException Should indicate an attempt to extract equals method
from interface.
+ */
+ public static Method extractEqualsMethod(Class clazz) throws NoSuchMethodException {
+ return clazz.getMethod( "equals", SINGLE_OBJECT_PARAM_SIGNATURE );
+ }
+
+ /**
+ * Encapsulation of getting hold of a class's {@link Object#hashCode hashCode}
method.
+ *
+ * @param clazz The class from which to extract the hashCode method.
+ * @return The hashCode method reference
+ * @throws NoSuchMethodException Should indicate an attempt to extract hashCode method
from interface.
+ */
+ public static Method extractHashCodeMethod(Class clazz) throws NoSuchMethodException {
+ return clazz.getMethod( "hashCode", NO_PARAM_SIGNATURE );
+ }
+
+ /**
+ * Determine if the given class defines an {@link Object#equals} override.
+ *
+ * @param clazz The class to check
+ * @return True if clazz defines an equals override.
+ */
+ public static boolean overridesEquals(Class clazz) {
+ Method equals;
+ try {
+ equals = extractEqualsMethod( clazz );
+ }
+ catch ( NoSuchMethodException nsme ) {
+ return false; //its an interface so we can't really tell anything...
+ }
+ return !OBJECT_EQUALS.equals( equals );
+ }
+
+ /**
+ * Determine if the given class defines a {@link Object#hashCode} override.
+ *
+ * @param clazz The class to check
+ * @return True if clazz defines an hashCode override.
+ */
+ public static boolean overridesHashCode(Class clazz) {
+ Method hashCode;
+ try {
+ hashCode = extractHashCodeMethod( clazz );
+ }
+ catch ( NoSuchMethodException nsme ) {
+ return false; //its an interface so we can't really tell anything...
+ }
+ return !OBJECT_HASHCODE.equals( hashCode );
+ }
+
+ /**
+ * Determine if the given class implements the given interface.
+ *
+ * @param clazz The class to check
+ * @param intf The interface to check it against.
+ * @return True if the class does implement the interface, false otherwise.
+ */
+ public static boolean implementsInterface(Class clazz, Class intf) {
+ assert intf.isInterface() : "Interface to check was not an interface";
+ return intf.isAssignableFrom( clazz );
+ }
+
+ /**
+ * Perform resolution of a class name.
+ * <p/>
+ * Here we first check the context classloader, if one, before delegating to
+ * {@link Class#forName(String, boolean, ClassLoader)} using the caller's
classloader
+ *
+ * @param name The class name
+ * @param caller The class from which this call originated (in order to access that
class's loader).
+ * @return The class reference.
+ * @throws ClassNotFoundException From {@link Class#forName(String, boolean,
ClassLoader)}.
+ */
+ public static Class classForName(String name, Class caller) throws
ClassNotFoundException {
+ try {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ if ( contextClassLoader != null ) {
+ return contextClassLoader.loadClass( name );
+ }
+ }
+ catch ( Throwable ignore ) {
+ }
+ return Class.forName( name, true, caller.getClassLoader() );
+ }
+
+ /**
+ * Perform resolution of a class name.
+ * <p/>
+ * Same as {@link #classForName(String, Class)} except that here we delegate to
+ * {@link Class#forName(String)} if the context classloader lookup is unsuccessful.
+ *
+ * @param name The class name
+ * @return The class reference.
+ * @throws ClassNotFoundException From {@link Class#forName(String)}.
+ */
+ public static Class classForName(String name) throws ClassNotFoundException {
+ try {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ if ( contextClassLoader != null ) {
+ return contextClassLoader.loadClass(name);
+ }
+ }
+ catch ( Throwable ignore ) {
+ }
+ return Class.forName( name );
+ }
+
+ /**
+ * Is this member publicly accessible.
+ * <p/>
+ * Short-hand for {@link #isPublic(Class, Member)} passing the member + {@link
Member#getDeclaringClass()}
+ *
+ * @param member The member to check
+ * @return True if the member is publicly accessible.
+ */
+ public static boolean isPublic(Member member) {
+ return isPublic( member.getDeclaringClass(), member );
+ }
+
+ /**
+ * Is this member publicly accessible.
+ *
+ * @param clazz The class which defines the member
+ * @param member The memeber.
+ * @return True if the member is publicly accessible, false otherwise.
+ */
+ public static boolean isPublic(Class clazz, Member member) {
+ return Modifier.isPublic( member.getModifiers() ) && Modifier.isPublic(
clazz.getModifiers() );
+ }
+
+ /**
+ * Attempt to resolve the specified property type through reflection.
+ *
+ * @param className The name of the class owning the property.
+ * @param name The name of the property.
+ * @return The type of the property.
+ * @throws MappingException Indicates we were unable to locate the property.
+ */
+ public static Class reflectedPropertyClass(String className, String name) throws
MappingException {
+ try {
+ Class clazz = ReflectHelper.classForName( className );
+ return getter( clazz, name ).getReturnType();
+ }
+ catch ( ClassNotFoundException cnfe ) {
+ throw new MappingException( "class " + className + " not found while
looking for property: " + name, cnfe );
+ }
+ }
+
+ private static Getter getter(Class clazz, String name) throws MappingException {
+ try {
+ return BASIC_PROPERTY_ACCESSOR.getGetter( clazz, name );
+ }
+ catch ( PropertyNotFoundException pnfe ) {
+ return DIRECT_PROPERTY_ACCESSOR.getGetter( clazz, name );
+ }
+ }
+
+ /**
+ * Directly retrieve the {@link Getter} reference via the {@link
BasicPropertyAccessor}.
+ *
+ * @param theClass The class owning the property
+ * @param name The name of the property
+ * @return The getter.
+ * @throws MappingException Indicates we were unable to locate the property.
+ */
+ public static Getter getGetter(Class theClass, String name) throws MappingException {
+ return BASIC_PROPERTY_ACCESSOR.getGetter( theClass, name );
+ }
+
+ /**
+ * Resolve a constant to its actual value.
+ *
+ * @param name The name
+ * @return The value
+ */
+ public static Object getConstantValue(String name) {
+ Class clazz;
+ try {
+ clazz = classForName( StringHelper.qualifier( name ) );
+ }
+ catch ( Throwable t ) {
+ return null;
+ }
+ try {
+ return clazz.getField( StringHelper.unqualify( name ) ).get( null );
+ }
+ catch ( Throwable t ) {
+ return null;
+ }
+ }
+
+ /**
+ * Retrieve the default (no arg) constructor from the given class.
+ *
+ * @param clazz The class for which to retrieve the default ctor.
+ * @return The default constructor.
+ * @throws PropertyNotFoundException Indicates there was not publicly accessible, no-arg
constructor (todo : why PropertyNotFoundException???)
+ */
+ public static Constructor getDefaultConstructor(Class clazz) throws
PropertyNotFoundException {
+ if ( isAbstractClass( clazz ) ) {
+ return null;
+ }
+
+ try {
+ Constructor constructor = clazz.getDeclaredConstructor( NO_PARAM_SIGNATURE );
+ if ( !isPublic( clazz, constructor ) ) {
+ constructor.setAccessible( true );
+ }
+ return constructor;
+ }
+ catch ( NoSuchMethodException nme ) {
+ throw new PropertyNotFoundException(
+ "Object class [" + clazz.getName() + "] must declare a default
(no-argument) constructor"
+ );
+ }
+ }
+
+ /**
+ * Determine if the given class is declared abstract.
+ *
+ * @param clazz The class to check.
+ * @return True if the class is abstract, false otherwise.
+ */
+ public static boolean isAbstractClass(Class clazz) {
+ int modifier = clazz.getModifiers();
+ return Modifier.isAbstract(modifier) || Modifier.isInterface(modifier);
+ }
+
+ /**
+ * Determine is the given class is declared final.
+ *
+ * @param clazz The class to check.
+ * @return True if the class is final, flase otherwise.
+ */
+ public static boolean isFinalClass(Class clazz) {
+ return Modifier.isFinal( clazz.getModifiers() );
+ }
+
+ /**
+ * Retrieve a constructor for the given class, with arguments matching the specified
Hibernate mapping
+ * {@link Type types}.
+ *
+ * @param clazz The class needing instantiation
+ * @param types The types representing the required ctor param signature
+ * @return The matching constructor.
+ * @throws PropertyNotFoundException Indicates we could not locate an appropriate
constructor (todo : again with PropertyNotFoundException???)
+ */
+ public static Constructor getConstructor(Class clazz, Type[] types) throws
PropertyNotFoundException {
+ final Constructor[] candidates = clazz.getConstructors();
+ for ( int i = 0; i < candidates.length; i++ ) {
+ final Constructor constructor = candidates[i];
+ final Class[] params = constructor.getParameterTypes();
+ if ( params.length == types.length ) {
+ boolean found = true;
+ for ( int j = 0; j < params.length; j++ ) {
+ final boolean ok = params[j].isAssignableFrom( types[j].getReturnedClass() ) || (
+ types[j] instanceof PrimitiveType &&
+ params[j] == ( ( PrimitiveType ) types[j] ).getPrimitiveClass()
+ );
+ if ( !ok ) {
+ found = false;
+ break;
+ }
+ }
+ if ( found ) {
+ if ( !isPublic( clazz, constructor ) ) {
+ constructor.setAccessible( true );
+ }
+ return constructor;
+ }
+ }
+ }
+ throw new PropertyNotFoundException( "no appropriate constructor in class: "
+ clazz.getName() );
+ }
+
+ public static Method getMethod(Class clazz, Method method) {
+ try {
+ return clazz.getMethod( method.getName(), method.getParameterTypes() );
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+}
Added:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/StringHelper.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/StringHelper.java
(rev 0)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/util/xpl/StringHelper.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -0,0 +1,601 @@
+/*
+ * 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
+ *
+ */
+package org.hibernate.util.xpl;
+
+import java.util.Iterator;
+import java.util.StringTokenizer;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.hibernate.dialect.Dialect;
+
+public final class StringHelper {
+
+ private static final int ALIAS_TRUNCATE_LENGTH = 10;
+ public static final String WHITESPACE = " \n\r\f\t";
+
+ private StringHelper() { /* static methods only - hide constructor */
+ }
+
+ /*public static boolean containsDigits(String string) {
+ for ( int i=0; i<string.length(); i++ ) {
+ if ( Character.isDigit( string.charAt(i) ) ) return true;
+ }
+ return false;
+ }*/
+
+ public static int lastIndexOfLetter(String string) {
+ for ( int i=0; i<string.length(); i++ ) {
+ char character = string.charAt(i);
+ if ( !Character.isLetter(character) /*&& !('_'==character)*/ ) return
i-1;
+ }
+ return string.length()-1;
+ }
+
+ public static String join(String seperator, String[] strings) {
+ int length = strings.length;
+ if ( length == 0 ) return "";
+ StringBuffer buf = new StringBuffer( length * strings[0].length() )
+ .append( strings[0] );
+ for ( int i = 1; i < length; i++ ) {
+ buf.append( seperator ).append( strings[i] );
+ }
+ return buf.toString();
+ }
+
+ public static String join(String seperator, Iterator objects) {
+ StringBuffer buf = new StringBuffer();
+ if ( objects.hasNext() ) buf.append( objects.next() );
+ while ( objects.hasNext() ) {
+ buf.append( seperator ).append( objects.next() );
+ }
+ return buf.toString();
+ }
+
+ public static String[] add(String[] x, String sep, String[] y) {
+ String[] result = new String[x.length];
+ for ( int i = 0; i < x.length; i++ ) {
+ result[i] = x[i] + sep + y[i];
+ }
+ return result;
+ }
+
+ public static String repeat(String string, int times) {
+ StringBuffer buf = new StringBuffer( string.length() * times );
+ for ( int i = 0; i < times; i++ ) buf.append( string );
+ return buf.toString();
+ }
+
+ public static String repeat(char character, int times) {
+ char[] buffer = new char[times];
+ Arrays.fill( buffer, character );
+ return new String( buffer );
+ }
+
+
+ public static String replace(String template, String placeholder, String replacement) {
+ return replace( template, placeholder, replacement, false );
+ }
+
+ public static String[] replace(String templates[], String placeholder, String
replacement) {
+ String[] result = new String[templates.length];
+ for ( int i =0; i<templates.length; i++ ) {
+ result[i] = replace( templates[i], placeholder, replacement );
+ }
+ return result;
+ }
+
+ public static String replace(String template, String placeholder, String replacement,
boolean wholeWords) {
+ if ( template == null ) {
+ return template;
+ }
+ int loc = template.indexOf( placeholder );
+ if ( loc < 0 ) {
+ return template;
+ }
+ else {
+ final boolean actuallyReplace = !wholeWords ||
+ loc + placeholder.length() == template.length() ||
+ !Character.isJavaIdentifierPart( template.charAt( loc + placeholder.length() ) );
+ String actualReplacement = actuallyReplace ? replacement : placeholder;
+ return new StringBuffer( template.substring( 0, loc ) )
+ .append( actualReplacement )
+ .append( replace( template.substring( loc + placeholder.length() ),
+ placeholder,
+ replacement,
+ wholeWords ) ).toString();
+ }
+ }
+
+
+ public static String replaceOnce(String template, String placeholder, String
replacement) {
+ if ( template == null ) {
+ return template; // returnign null!
+ }
+ int loc = template.indexOf( placeholder );
+ if ( loc < 0 ) {
+ return template;
+ }
+ else {
+ return new StringBuffer( template.substring( 0, loc ) )
+ .append( replacement )
+ .append( template.substring( loc + placeholder.length() ) )
+ .toString();
+ }
+ }
+
+
+ public static String[] split(String seperators, String list) {
+ return split( seperators, list, false );
+ }
+
+ public static String[] split(String seperators, String list, boolean include) {
+ StringTokenizer tokens = new StringTokenizer( list, seperators, include );
+ String[] result = new String[ tokens.countTokens() ];
+ int i = 0;
+ while ( tokens.hasMoreTokens() ) {
+ result[i++] = tokens.nextToken();
+ }
+ return result;
+ }
+
+ public static String unqualify(String qualifiedName) {
+ int loc = qualifiedName.lastIndexOf(".");
+ return ( loc < 0 ) ? qualifiedName : qualifiedName.substring(
qualifiedName.lastIndexOf(".") + 1 );
+ }
+
+ public static String qualifier(String qualifiedName) {
+ int loc = qualifiedName.lastIndexOf(".");
+ return ( loc < 0 ) ? "" : qualifiedName.substring( 0, loc );
+ }
+
+ /**
+ * Collapses a name. Mainly intended for use with classnames, where an example might
serve best to explain.
+ * Imagine you have a class named
<samp>'org.hibernate.util.StringHelper'</samp>; calling collapse on
that
+ * classname will result in <samp>'o.h.u.StringHelper'<samp>.
+ *
+ * @param name The name to collapse.
+ * @return The collapsed name.
+ */
+ public static String collapse(String name) {
+ if ( name == null ) {
+ return null;
+ }
+ int breakPoint = name.lastIndexOf( '.' );
+ if ( breakPoint < 0 ) {
+ return name;
+ }
+ return collapseQualifier( name.substring( 0, breakPoint ), true ) + name.substring(
breakPoint ); // includes last '.'
+ }
+
+ /**
+ * Given a qualifier, collapse it.
+ *
+ * @param qualifier The qualifier to collapse.
+ * @param includeDots Should we include the dots in the collapsed form?
+ *
+ * @return The collapsed form.
+ */
+ public static String collapseQualifier(String qualifier, boolean includeDots) {
+ StringTokenizer tokenizer = new StringTokenizer( qualifier, "." );
+ String collapsed = Character.toString( tokenizer.nextToken().charAt( 0 ) );
+ while ( tokenizer.hasMoreTokens() ) {
+ if ( includeDots ) {
+ collapsed += '.';
+ }
+ collapsed += tokenizer.nextToken().charAt( 0 );
+ }
+ return collapsed;
+ }
+
+ /**
+ * Partially unqualifies a qualified name. For example, with a base of
'org.hibernate' the name
+ * 'org.hibernate.util.StringHelper' would become 'util.StringHelper'.
+ *
+ * @param name The (potentially) qualified name.
+ * @param qualifierBase The qualifier base.
+ *
+ * @return The name itself, or the partially unqualified form if it begins with the
qualifier base.
+ */
+ public static String partiallyUnqualify(String name, String qualifierBase) {
+ if ( name == null || ! name.startsWith( qualifierBase ) ) {
+ return name;
+ }
+ return name.substring( qualifierBase.length() + 1 ); // +1 to start after the following
'.'
+ }
+
+ /**
+ * Cross between {@link #collapse} and {@link #partiallyUnqualify}. Functions much like
{@link #collapse}
+ * except that only the qualifierBase is collapsed. For example, with a base of
'org.hibernate' the name
+ * 'org.hibernate.util.StringHelper' would become
'o.h.util.StringHelper'.
+ *
+ * @param name The (potentially) qualified name.
+ * @param qualifierBase The qualifier base.
+ *
+ * @return The name itself if it does not begin with the qualifierBase, or the properly
collapsed form otherwise.
+ */
+ public static String collapseQualifierBase(String name, String qualifierBase) {
+ if ( name == null || ! name.startsWith( qualifierBase ) ) {
+ return collapse( name );
+ }
+ return collapseQualifier( qualifierBase, true ) + name.substring(
qualifierBase.length() );
+ }
+
+ public static String[] suffix(String[] columns, String suffix) {
+ if ( suffix == null ) return columns;
+ String[] qualified = new String[columns.length];
+ for ( int i = 0; i < columns.length; i++ ) {
+ qualified[i] = suffix( columns[i], suffix );
+ }
+ return qualified;
+ }
+
+ private static String suffix(String name, String suffix) {
+ return ( suffix == null ) ? name : name + suffix;
+ }
+
+ public static String root(String qualifiedName) {
+ int loc = qualifiedName.indexOf( "." );
+ return ( loc < 0 ) ? qualifiedName : qualifiedName.substring( 0, loc );
+ }
+
+ public static String unroot(String qualifiedName) {
+ int loc = qualifiedName.indexOf( "." );
+ return ( loc < 0 ) ? qualifiedName : qualifiedName.substring( loc+1,
qualifiedName.length() );
+ }
+
+ public static boolean booleanValue(String tfString) {
+ String trimmed = tfString.trim().toLowerCase();
+ return trimmed.equals( "true" ) || trimmed.equals( "t" );
+ }
+
+ public static String toString(Object[] array) {
+ int len = array.length;
+ if ( len == 0 ) return "";
+ StringBuffer buf = new StringBuffer( len * 12 );
+ for ( int i = 0; i < len - 1; i++ ) {
+ buf.append( array[i] ).append(", ");
+ }
+ return buf.append( array[len - 1] ).toString();
+ }
+
+ public static String[] multiply(String string, Iterator placeholders, Iterator
replacements) {
+ String[] result = new String[]{string};
+ while ( placeholders.hasNext() ) {
+ result = multiply( result, ( String ) placeholders.next(), ( String[] )
replacements.next() );
+ }
+ return result;
+ }
+
+ private static String[] multiply(String[] strings, String placeholder, String[]
replacements) {
+ String[] results = new String[replacements.length * strings.length];
+ int n = 0;
+ for ( int i = 0; i < replacements.length; i++ ) {
+ for ( int j = 0; j < strings.length; j++ ) {
+ results[n++] = replaceOnce( strings[j], placeholder, replacements[i] );
+ }
+ }
+ return results;
+ }
+
+ public static int countUnquoted(String string, char character) {
+ if ( '\'' == character ) {
+ throw new IllegalArgumentException( "Unquoted count of quotes is invalid"
);
+ }
+ if (string == null)
+ return 0;
+ // Impl note: takes advantage of the fact that an escpaed single quote
+ // embedded within a quote-block can really be handled as two seperate
+ // quote-blocks for the purposes of this method...
+ int count = 0;
+ int stringLength = string.length();
+ boolean inQuote = false;
+ for ( int indx = 0; indx < stringLength; indx++ ) {
+ char c = string.charAt( indx );
+ if ( inQuote ) {
+ if ( '\'' == c ) {
+ inQuote = false;
+ }
+ }
+ else if ( '\'' == c ) {
+ inQuote = true;
+ }
+ else if ( c == character ) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ public static int[] locateUnquoted(String string, char character) {
+ if ( '\'' == character ) {
+ throw new IllegalArgumentException( "Unquoted count of quotes is invalid"
);
+ }
+ if (string == null) {
+ return new int[0];
+ }
+
+ ArrayList locations = new ArrayList( 20 );
+
+ // Impl note: takes advantage of the fact that an escpaed single quote
+ // embedded within a quote-block can really be handled as two seperate
+ // quote-blocks for the purposes of this method...
+ int stringLength = string.length();
+ boolean inQuote = false;
+ for ( int indx = 0; indx < stringLength; indx++ ) {
+ char c = string.charAt( indx );
+ if ( inQuote ) {
+ if ( '\'' == c ) {
+ inQuote = false;
+ }
+ }
+ else if ( '\'' == c ) {
+ inQuote = true;
+ }
+ else if ( c == character ) {
+ locations.add( new Integer( indx ) );
+ }
+ }
+ return ArrayHelper.toIntArray( locations );
+ }
+
+ public static boolean isNotEmpty(String string) {
+ return string != null && string.length() > 0;
+ }
+
+ public static boolean isEmpty(String string) {
+ return string == null || string.length() == 0;
+ }
+
+ public static String qualify(String prefix, String name) {
+ if ( name == null || prefix == null ) {
+ throw new NullPointerException();
+ }
+ return new StringBuffer( prefix.length() + name.length() + 1 )
+ .append(prefix)
+ .append('.')
+ .append(name)
+ .toString();
+ }
+
+ public static String[] qualify(String prefix, String[] names) {
+ if ( prefix == null ) return names;
+ int len = names.length;
+ String[] qualified = new String[len];
+ for ( int i = 0; i < len; i++ ) {
+ qualified[i] = qualify( prefix, names[i] );
+ }
+ return qualified;
+ }
+
+ public static int firstIndexOfChar(String sqlString, String string, int startindex) {
+ int matchAt = -1;
+ for ( int i = 0; i < string.length(); i++ ) {
+ int curMatch = sqlString.indexOf( string.charAt( i ), startindex );
+ if ( curMatch >= 0 ) {
+ if ( matchAt == -1 ) { // first time we find match!
+ matchAt = curMatch;
+ }
+ else {
+ matchAt = Math.min( matchAt, curMatch );
+ }
+ }
+ }
+ return matchAt;
+ }
+
+ public static String truncate(String string, int length) {
+ if ( string.length() <= length ) {
+ return string;
+ }
+ else {
+ return string.substring( 0, length );
+ }
+ }
+
+ public static String generateAlias(String description) {
+ return generateAliasRoot(description) + '_';
+ }
+
+ /**
+ * Generate a nice alias for the given class name or collection role name and unique
integer. Subclasses of
+ * Loader do <em>not</em> have to use aliases of this form.
+ *
+ * @param description The base name (usually an entity-name or collection-role)
+ * @param unique A uniquing value
+ *
+ * @return an alias of the form <samp>foo1_</samp>
+ */
+ public static String generateAlias(String description, int unique) {
+ return generateAliasRoot(description) +
+ Integer.toString(unique) +
+ '_';
+ }
+
+ /**
+ * Generates a root alias by truncating the "root name" defined by
+ * the incoming decription and removing/modifying any non-valid
+ * alias characters.
+ *
+ * @param description The root name from which to generate a root alias.
+ * @return The generated root alias.
+ */
+ private static String generateAliasRoot(String description) {
+ String result = truncate( unqualifyEntityName(description), ALIAS_TRUNCATE_LENGTH )
+ .toLowerCase()
+ .replace( '/', '_' ) // entityNames may now include slashes for
the representations
+ .replace( '$', '_' ); //classname may be an inner class
+ result = cleanAlias( result );
+ if ( Character.isDigit( result.charAt(result.length()-1) ) ) {
+ return result + "x"; //ick!
+ }
+ else {
+ return result;
+ }
+ }
+
+ /**
+ * Clean the generated alias by removing any non-alpha characters from the
+ * beginning.
+ *
+ * @param alias The generated alias to be cleaned.
+ * @return The cleaned alias, stripped of any leading non-alpha characters.
+ */
+ private static String cleanAlias(String alias) {
+ char[] chars = alias.toCharArray();
+ // short cut check...
+ if ( !Character.isLetter( chars[0] ) ) {
+ for ( int i = 1; i < chars.length; i++ ) {
+ // as soon as we encounter our first letter, return the substring
+ // from that position
+ if ( Character.isLetter( chars[i] ) ) {
+ return alias.substring( i );
+ }
+ }
+ }
+ return alias;
+ }
+
+ public static String unqualifyEntityName(String entityName) {
+ String result = unqualify(entityName);
+ int slashPos = result.indexOf( '/' );
+ if ( slashPos > 0 ) {
+ result = result.substring( 0, slashPos - 1 );
+ }
+ return result;
+ }
+
+ public static String toUpperCase(String str) {
+ return str==null ? null : str.toUpperCase();
+ }
+
+ public static String toLowerCase(String str) {
+ return str==null ? null : str.toLowerCase();
+ }
+
+ public static String moveAndToBeginning(String filter) {
+ if ( filter.trim().length()>0 ){
+ filter += " and ";
+ if ( filter.startsWith(" and ") ) filter = filter.substring(4);
+ }
+ return filter;
+ }
+
+ /**
+ * Determine if the given string is quoted (wrapped by '`' characters at
beginning and end).
+ *
+ * @param name The name to check.
+ * @return True if the given string starts and ends with '`'; false otherwise.
+ */
+ public static boolean isQuoted(String name) {
+ return name != null && name.length() != 0 && name.charAt( 0 ) ==
'`' && name.charAt( name.length() - 1 ) == '`';
+ }
+
+ /**
+ * Return a representation of the given name ensuring quoting (wrapped with '`'
characters). If already wrapped
+ * return name.
+ *
+ * @param name The name to quote.
+ * @return The quoted version.
+ */
+ public static String quote(String name) {
+ if ( name == null || name.length() == 0 || isQuoted( name ) ) {
+ return name;
+ }
+ else {
+ return new StringBuffer( name.length() + 2 ).append('`').append( name
).append( '`' ).toString();
+ }
+ }
+
+ /**
+ * Return the unquoted version of name (stripping the start and end '`'
characters if present).
+ *
+ * @param name The name to be unquoted.
+ * @return The unquoted version.
+ */
+ public static String unquote(String name) {
+ if ( isQuoted( name ) ) {
+ return name.substring( 1, name.length() - 1 );
+ }
+ else {
+ return name;
+ }
+ }
+
+ /**
+ * Determine if the given name is quoted. It is considered quoted if either:
+ * <ol>
+ * <li>starts AND ends with backticks (`)</li>
+ * <li>starts with dialect-specified {@link
org.hibernate.dialect.Dialect#openQuote() open-quote}
+ * AND ends with dialect-specified {@link org.hibernate.dialect.Dialect#closeQuote()
close-quote}</li>
+ * </ol>
+ *
+ * @param name The name to check
+ * @param dialect The dialect (to determine the "real" quoting chars).
+ *
+ * @return True if quoted, false otherwise
+ */
+ public static boolean isQuoted(String name, Dialect dialect) {
+ return name != null && name.length() != 0
+ && ( name.charAt( 0 ) == '`' && name.charAt( name.length() -
1 ) == '`'
+ || name.charAt( 0 ) == dialect.openQuote() && name.charAt( name.length() - 1
) == dialect.closeQuote() );
+ }
+
+ /**
+ * Return the unquoted version of name stripping the start and end quote characters.
+ *
+ * @param name The name to be unquoted.
+ * @param dialect The dialect (to determine the "real" quoting chars).
+ *
+ * @return The unquoted version.
+ */
+ public static String unquote(String name, Dialect dialect) {
+ if ( isQuoted( name, dialect ) ) {
+ return name.substring( 1, name.length() - 1 );
+ }
+ else {
+ return name;
+ }
+ }
+
+ /**
+ * Return the unquoted version of name stripping the start and end quote characters.
+ *
+ * @param names The names to be unquoted.
+ * @param dialect The dialect (to determine the "real" quoting chars).
+ *
+ * @return The unquoted versions.
+ */
+ public static String[] unquote(String[] names, Dialect dialect) {
+ if ( names == null ) {
+ return null;
+ }
+ String[] unquoted = new String[ names.length ];
+ for ( int i = 0; i < names.length; i++ ) {
+ unquoted[i] = unquote( names[i], dialect );
+ }
+ return unquoted;
+ }
+}
Added:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ArtifactCollectorImpl.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ArtifactCollectorImpl.java
(rev 0)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ArtifactCollectorImpl.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -0,0 +1,20 @@
+package org.hibernate.eclipse.console.ext;
+
+import java.io.File;
+import java.util.Set;
+
+public class ArtifactCollectorImpl implements IArtifactCollector {
+
+ @Override
+ public File[] getFiles(String type) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Set getFileTypes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -53,7 +53,7 @@
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.tool.hbm2x.Exporter;
-import org.hibernate.util.ReflectHelper;
+import org.hibernate.util.xpl.ReflectHelper;
/**
* Represents what is specified in plugin.xml about possible exporters.
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -26,7 +26,7 @@
import org.hibernate.tool.hbm2x.GenericExporter;
import org.hibernate.tool.hbm2x.Hbm2DDLExporter;
import org.hibernate.tool.hbm2x.QueryExporter;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
/**
* ExporterFactory is used in UI to hold additional configuration for Exporter
definitions
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/Formatter.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -5,7 +5,7 @@
import java.util.Set;
import java.util.StringTokenizer;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
/**
* Old formatter from previous Hibernate versions which allowed a bit more control, i.e.
we want *less* spaces not more.
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -64,7 +64,7 @@
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.hibernate.tool.hbm2x.Cfg2HbmTool;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.hibernate.util.XMLHelper;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtilsEjb3.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -3,7 +3,9 @@
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -30,7 +32,6 @@
import org.hibernate.ejb.packaging.PackageFilter;
import org.hibernate.ejb.packaging.PersistenceMetadata;
import org.hibernate.ejb.packaging.PersistenceXmlLoader;
-import org.hibernate.util.CollectionHelper;
/**
* Most functions in this utility class are copy of
@@ -43,6 +44,7 @@
public static final String META_INF_PERS_XML = "META-INF/persistence.xml";
//$NON-NLS-1$
public static final String META_INF_ORM_XML = "META-INF/orm.xml";
//$NON-NLS-1$
+ private static final Map EMPTY_MAP = Collections.unmodifiableMap( new HashMap(0) );
private OpenMappingUtilsEjb3() {}
@@ -72,7 +74,7 @@
List<PersistenceMetadata> metadataFiles = null;
try {
metadataFiles = PersistenceXmlLoader.deploy(
- url, CollectionHelper.EMPTY_MAP,
+ url, EMPTY_MAP,
consoleConfiguration.getConfiguration().getEntityResolver(),
PersistenceUnitTransactionType.RESOURCE_LOCAL);
} catch (Exception e1) {
@@ -93,7 +95,7 @@
JarVisitor visitor = null;
URL visitorJarURL = null;
if (metadata.getName() == null) {
- visitor = getMainJarVisitor(url, metadata, CollectionHelper.EMPTY_MAP);
+ visitor = getMainJarVisitor(url, metadata, EMPTY_MAP);
visitorJarURL = JarVisitorFactory.getJarURLFromURLEntry(url, "/" +
META_INF_PERS_XML); //$NON-NLS-1$
metadata.setName(visitor.getUnqualifiedJarName());
}
@@ -103,7 +105,7 @@
break;
} else if (persistenceUnitName == null ||
metadata.getName().equals(persistenceUnitName)) {
if (visitor == null) {
- visitor = getMainJarVisitor(url, metadata, CollectionHelper.EMPTY_MAP);
+ visitor = getMainJarVisitor(url, metadata, EMPTY_MAP);
visitorJarURL = JarVisitorFactory.getJarURLFromURLEntry(url, "/" +
META_INF_PERS_XML); //$NON-NLS-1$
}
try {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -69,7 +69,7 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.properties.HibernatePropertiesConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
import org.xml.sax.InputSource;
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/DynamicSQLPreviewView.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -56,7 +56,7 @@
import org.hibernate.hql.QueryTranslator;
import org.hibernate.impl.SessionFactoryImpl;
import org.hibernate.type.Type;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
public class DynamicSQLPreviewView extends ViewPart {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -48,7 +48,6 @@
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
@@ -65,14 +64,13 @@
import org.hibernate.console.ConsoleQueryParameter;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.QueryInputModel;
-import org.hibernate.console.StringListDialog;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.QueryEditor;
import org.hibernate.eclipse.console.utils.EclipseImages;
+import org.hibernate.util.xpl.StringHelper;
import org.hibernate.hql.classic.ParserHelper;
import org.hibernate.type.NullableType;
import org.hibernate.type.Type;
-import org.hibernate.util.StringHelper;
public class QueryParametersPage extends Page implements IQueryParametersPage {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -79,7 +79,7 @@
import org.hibernate.eclipse.launch.ConsoleConfigurationMainTab;
import org.hibernate.eclipse.launch.ConsoleConfigurationTabGroup;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
/**
* This wizardpage wraps the LaunchConfiguration based tabs and thus mimicks the normal
launch configuration ui.
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/TableFilterView.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/TableFilterView.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/TableFilterView.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -47,7 +47,7 @@
import org.hibernate.eclipse.console.workbench.xpl.AnyAdaptableLabelProvider;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Table;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
public abstract class TableFilterView extends TreeToTableComposite {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/HibernateWorkbenchHelper.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/HibernateWorkbenchHelper.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/workbench/HibernateWorkbenchHelper.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -27,7 +27,7 @@
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
public class HibernateWorkbenchHelper {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/JavaCompletionProcessor.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/JavaCompletionProcessor.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/criteriaeditor/JavaCompletionProcessor.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -38,7 +38,7 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.hqleditor.CompletionHelper;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
public class JavaCompletionProcessor implements IContentAssistProcessor {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyAssociationViewAdapter.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyAssociationViewAdapter.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/graph/model/PropertyAssociationViewAdapter.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -21,7 +21,7 @@
*/
package org.hibernate.eclipse.graph.model;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
public class PropertyAssociationViewAdapter extends AssociationViewAdapter {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/EclipseHQLCompletionRequestor.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -31,7 +31,7 @@
import org.hibernate.eclipse.console.workbench.HibernateWorkbenchHelper;
import org.hibernate.tool.ide.completion.HQLCompletionProposal;
import org.hibernate.tool.ide.completion.IHQLCompletionRequestor;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
public class EclipseHQLCompletionRequestor implements IHQLCompletionRequestor {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/AddPropertyDialog.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -53,7 +53,7 @@
import org.hibernate.eclipse.console.model.impl.ExporterFactory;
import org.hibernate.eclipse.console.model.impl.ExporterProperty;
import org.hibernate.eclipse.console.utils.DialogSelectionHelper;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
/**
* Add/edit property dialog to configure Hibernate Exporters.
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -46,7 +46,7 @@
import org.hibernate.console.preferences.PreferencesClassPathUtils;
import org.hibernate.eclipse.console.model.impl.ExporterFactory;
import
org.hibernate.eclipse.launch.ExportersXMLAttributeDescription.AttributeDescription;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
/**
* XML document part creation factory,
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -84,8 +84,8 @@
import org.hibernate.eclipse.console.model.impl.ExporterFactory;
import org.hibernate.tool.hbm2x.ArtifactCollector;
import org.hibernate.tool.hbm2x.Exporter;
-import org.hibernate.util.ReflectHelper;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.ReflectHelper;
+import org.hibernate.util.xpl.StringHelper;
@SuppressWarnings("restriction")
public class CodeGenerationLaunchDelegate extends AntLaunchDelegate {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationMainTab.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -52,7 +52,7 @@
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.eclipse.console.wizards.NewConfigurationWizard;
import org.hibernate.eclipse.console.wizards.NewConfigurationWizardPage;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
@SuppressWarnings("restriction")
public class ConsoleConfigurationMainTab extends ConsoleConfigurationTab {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTab.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTab.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConsoleConfigurationTab.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -14,7 +14,7 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Text;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
abstract public class ConsoleConfigurationTab extends AbstractLaunchConfigurationTab {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -67,7 +67,7 @@
import org.hibernate.mapping.Table;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
/**
* @author Dmitry Geraskov
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/ReverseEngineeringEditor.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -58,7 +58,7 @@
import org.hibernate.eclipse.mapper.editors.xpl.XMLFormEditorPart;
import org.hibernate.eclipse.mapper.model.DOMReverseEngineeringDefinition;
import org.hibernate.eclipse.nature.HibernateNature;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.w3c.dom.Document;
public class ReverseEngineeringEditor extends XMLFormEditorPart {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/ConsoleConfigNamePart.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/ConsoleConfigNamePart.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/editors/reveng/ConsoleConfigNamePart.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -35,7 +35,7 @@
import org.hibernate.eclipse.mapper.MapperMessages;
import org.hibernate.eclipse.mapper.MapperPlugin;
import org.hibernate.eclipse.mapper.editors.ReverseEngineeringEditor;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
public class ConsoleConfigNamePart extends RevEngSectionPart {
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -43,7 +43,7 @@
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.reveng.TableIdentifier;
import org.hibernate.eclipse.mapper.MapperMessages;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/JavaTypeHandler.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/JavaTypeHandler.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/JavaTypeHandler.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -28,7 +28,7 @@
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.hibernate.eclipse.hqleditor.CompletionHelper;
import org.hibernate.eclipse.hqleditor.HibernateResultCollector.Settings;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.w3c.dom.Attr;
import org.w3c.dom.Node;
Modified:
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -25,7 +25,7 @@
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.hibernate.eclipse.hqleditor.CompletionHelper;
import org.hibernate.eclipse.hqleditor.HibernateResultCollector.Settings;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.w3c.dom.Node;
public class PackageHandler extends JavaTypeHandler {
Modified:
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -18,7 +18,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
/**
Modified:
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
---
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2011-11-21
18:49:43 UTC (rev 36511)
+++
branches/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2011-11-21
21:58:54 UTC (rev 36512)
@@ -51,7 +51,7 @@
import org.hibernate.eclipse.console.utils.LaunchHelper;
import org.hibernate.eclipse.launch.PathHelper;
import org.hibernate.tool.hbm2x.StringUtils;
-import org.hibernate.util.StringHelper;
+import org.hibernate.util.xpl.StringHelper;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;