1 package de.juplo.plugins.hibernate4;
4 * Copyright 2001-2005 The Apache Software Foundation.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 import com.pyx4j.log4j.MavenLogAppender;
21 import java.io.FileInputStream;
22 import java.io.FileNotFoundException;
23 import java.io.FileOutputStream;
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.ObjectInputStream;
27 import java.io.ObjectOutputStream;
28 import java.math.BigInteger;
30 import java.net.URLClassLoader;
31 import java.security.MessageDigest;
32 import java.security.NoSuchAlgorithmException;
33 import java.sql.Connection;
34 import java.sql.Driver;
35 import java.sql.DriverManager;
36 import java.sql.DriverPropertyInfo;
37 import java.sql.SQLException;
38 import java.sql.SQLFeatureNotSupportedException;
39 import java.util.Comparator;
40 import java.util.Enumeration;
41 import java.util.HashMap;
42 import java.util.HashSet;
43 import java.util.List;
45 import java.util.Map.Entry;
46 import java.util.Properties;
48 import java.util.TreeSet;
49 import java.util.logging.Logger;
50 import java.util.regex.Matcher;
51 import java.util.regex.Pattern;
52 import javax.persistence.Embeddable;
53 import javax.persistence.Entity;
54 import javax.persistence.MappedSuperclass;
55 import org.apache.maven.artifact.Artifact;
56 import org.apache.maven.model.Resource;
57 import org.apache.maven.plugin.AbstractMojo;
58 import org.apache.maven.plugin.MojoExecutionException;
59 import org.apache.maven.plugin.MojoFailureException;
60 import org.apache.maven.project.MavenProject;
61 import org.hibernate.cfg.Configuration;
62 import org.hibernate.cfg.NamingStrategy;
63 import org.hibernate.envers.configuration.AuditConfiguration;
64 import org.hibernate.tool.hbm2ddl.SchemaExport;
65 import org.hibernate.tool.hbm2ddl.SchemaExport.Type;
66 import org.hibernate.tool.hbm2ddl.Target;
67 import org.scannotation.AnnotationDB;
71 * Goal which extracts the hibernate-mapping-configuration and
72 * exports an according SQL-database-schema.
75 * @phase process-classes
77 * @requiresDependencyResolution runtime
79 public class Hbm2DdlMojo extends AbstractMojo
81 public final static String EXPORT_SKIPPED_PROPERTY = "hibernate.export.skipped";
83 public final static String DRIVER_CLASS = "hibernate.connection.driver_class";
84 public final static String URL = "hibernate.connection.url";
85 public final static String USERNAME = "hibernate.connection.username";
86 public final static String PASSWORD = "hibernate.connection.password";
87 public final static String DIALECT = "hibernate.dialect";
88 public final static String NAMING_STRATEGY="hibernate.ejb.naming_strategy";
89 public final static String ENVERS = "hibernate.export.envers";
91 public final static String MD5S = "hibernate4-generatedschema.md5s";
93 private final static Pattern split = Pattern.compile("[^,\\s]+");
99 * Only needed internally.
101 * @parameter property="project"
105 private MavenProject project;
110 * Only needed internally.
112 * @parameter property="project.build.directory"
116 private String buildDirectory;
119 * Classes-Directory to scan.
121 * This parameter defaults to the maven build-output-directory for classes.
122 * Additonally, all dependencies are scanned for annotated classes.
124 * @parameter property="project.build.outputDirectory"
127 private String outputDirectory;
130 * Wether to scan test-classes too, or not.
132 * If this parameter is set to <code>true</code> the test-classes of the
133 * artifact will be scanned for hibernate-annotated classes additionally.
135 * @parameter property="hibernate.export.scan_testclasses" default-value="false"
138 private boolean scanTestClasses;
141 * Dependency-Scopes, that should be scanned for annotated classes.
143 * By default, only dependencies in the scope <code>compile</code> are
144 * scanned for annotated classes. Multiple scopes can be seperated by
145 * white space or commas.
147 * The plugin does not scan for annotated classes in transitive
148 * dependencies. If some of your annotated classes are hidden in a
149 * transitive dependency, you can simply add that dependency explicitly.
151 * @parameter property="hibernate.export.scan_dependencies" default-value="compile"
154 private String scanDependencies;
157 * Test-Classes-Directory to scan.
159 * This parameter defaults to the maven build-output-directory for
162 * This parameter is only used, when <code>scanTestClasses</code> is set
163 * to <code>true</code>!
165 * @parameter property="project.build.testOutputDirectory"
168 private String testOutputDirectory;
173 * If set to <code>true</code>, the execution is skipped.
175 * A skipped excecution is signaled via the maven-property
176 * <code>${hibernate.export.skipped}</code>.
178 * The excecution is skipped automatically, if no modified or newly added
179 * annotated classes are found and the dialect was not changed.
181 * @parameter property="hibernate.skip" default-value="${maven.test.skip}"
184 private boolean skip;
189 * Force execution, even if no modified or newly added annotated classes
190 * where found and the dialect was not changed.
192 * <code>skip</code> takes precedence over <code>force</code>.
194 * @parameter property="hibernate.export.force" default-value="false"
197 private boolean force;
202 * @parameter property="hibernate.connection.driver_class"
205 private String driverClassName;
210 * @parameter property="hibernate.connection.url"
218 * @parameter property="hibernate.connection.username"
221 private String username;
226 * @parameter property="hibernate.connection.password"
229 private String password;
234 * @parameter property="hibernate.dialect"
237 private String hibernateDialect;
240 * Hibernate Naming Strategy
242 * @parameter property="hibernate.ejb.naming_strategy"
245 private String hibernateNamingStrategy;
248 * Path to Hibernate configuration file.
250 * @parameter default-value="${project.build.outputDirectory}/hibernate.properties"
253 private String hibernateProperties;
256 * List of Hibernate-Mapping-Files (XML).
257 * Multiple files can be separated with white-spaces and/or commas.
259 * @parameter property="hibernate.mapping"
262 private String hibernateMapping;
265 * Target of execution:
267 * <li><strong>NONE</strong> only export schema to SQL-script (forces excecution, signals skip)</li>
268 * <li><strong>EXPORT</strong> create database (<strong>DEFAULT!</strong>). forces excecution, signals skip)</li>
269 * <li><strong>SCRIPT</strong> export schema to SQL-script and print it to STDOUT</li>
270 * <li><strong>BOTH</strong></li>
273 * A databaseconnection is only needed for EXPORT and BOTH, but a
274 * Hibernate-Dialect must always be choosen.
276 * @parameter property="hibernate.export.target" default-value="EXPORT"
279 private String target;
284 * <li><strong>NONE</strong> do nothing - just validate the configuration</li>
285 * <li><strong>CREATE</strong> create database-schema</li>
286 * <li><strong>DROP</strong> drop database-schema</li>
287 * <li><strong>BOTH</strong> (<strong>DEFAULT!</strong>)</li>
290 * If NONE is choosen, no databaseconnection is needed.
292 * @parameter property="hibernate.export.type" default-value="BOTH"
300 * @parameter property="hibernate.export.schema.filename" default-value="${project.build.directory}/schema.sql"
303 private String outputFile;
306 * Delimiter in output-file.
308 * @parameter property="hibernate.export.schema.delimiter" default-value=";"
311 private String delimiter;
314 * Format output-file.
316 * @parameter property="hibernate.export.schema.format" default-value="true"
319 private boolean format;
322 * Generate envers schema for auditing tables.
324 * @parameter property="hibernate.export.envers" default-value="false"
327 private boolean envers;
331 public void execute()
333 MojoFailureException,
334 MojoExecutionException
338 getLog().info("Exectuion of hibernate4-maven-plugin:export was skipped!");
339 project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true");
343 Map<String,String> md5s;
344 boolean modified = false;
345 File saved = new File(buildDirectory + File.separator + MD5S);
347 if (saved.isFile() && saved.length() > 0)
351 FileInputStream fis = new FileInputStream(saved);
352 ObjectInputStream ois = new ObjectInputStream(fis);
353 md5s = (HashMap<String,String>)ois.readObject();
358 md5s = new HashMap<String,String>();
359 getLog().warn("Cannot read timestamps from saved: " + e);
364 md5s = new HashMap<String,String>();
367 saved.createNewFile();
369 catch (IOException e)
371 getLog().debug("Cannot create file \"" + saved.getPath() + "\" for timestamps: " + e);
375 ClassLoader classLoader = null;
378 getLog().debug("Creating ClassLoader for project-dependencies...");
379 List<String> classpathFiles = project.getCompileClasspathElements();
381 classpathFiles.addAll(project.getTestClasspathElements());
382 URL[] urls = new URL[classpathFiles.size()];
383 for (int i = 0; i < classpathFiles.size(); ++i)
385 getLog().debug("Dependency: " + classpathFiles.get(i));
386 urls[i] = new File(classpathFiles.get(i)).toURI().toURL();
388 classLoader = new URLClassLoader(urls, getClass().getClassLoader());
392 getLog().error("Error while creating ClassLoader!", e);
393 throw new MojoExecutionException(e.getMessage());
396 Set<Class<?>> classes =
397 new TreeSet<Class<?>>(
398 new Comparator<Class<?>>() {
400 public int compare(Class<?> a, Class<?> b)
402 return a.getName().compareTo(b.getName());
409 AnnotationDB db = new AnnotationDB();
410 File dir = new File(outputDirectory);
413 getLog().info("Scanning directory " + outputDirectory + " for annotated classes...");
414 URL dirUrl = dir.toURI().toURL();
415 db.scanArchives(dirUrl);
419 dir = new File(testOutputDirectory);
422 getLog().info("Scanning directory " + testOutputDirectory + " for annotated classes...");
423 URL dirUrl = dir.toURI().toURL();
424 db.scanArchives(dirUrl);
427 if (scanDependencies != null)
429 Matcher matcher = split.matcher(scanDependencies);
430 while (matcher.find())
432 getLog().info("Scanning dependencies for scope " + matcher.group());
433 for (Artifact artifact : project.getDependencyArtifacts())
435 if (!artifact.getScope().equalsIgnoreCase(matcher.group()))
437 if (artifact.getFile() == null)
440 "Cannot scan dependency " +
442 ": no JAR-file available!"
447 "Scanning dependency " +
449 " for annotated classes..."
451 db.scanArchives(artifact.getFile().toURI().toURL());
456 Set<String> classNames = new HashSet<String>();
457 if (db.getAnnotationIndex().containsKey(Entity.class.getName()))
458 classNames.addAll(db.getAnnotationIndex().get(Entity.class.getName()));
459 if (db.getAnnotationIndex().containsKey(MappedSuperclass.class.getName()))
460 classNames.addAll(db.getAnnotationIndex().get(MappedSuperclass.class.getName()));
461 if (db.getAnnotationIndex().containsKey(Embeddable.class.getName()))
462 classNames.addAll(db.getAnnotationIndex().get(Embeddable.class.getName()));
464 MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
465 for (String name : classNames)
467 Class<?> annotatedClass = classLoader.loadClass(name);
468 classes.add(annotatedClass);
469 String resourceName = annotatedClass.getName();
470 resourceName = resourceName.substring(resourceName.lastIndexOf(".") + 1, resourceName.length()) + ".class";
473 .getResourceAsStream(resourceName);
474 byte[] buffer = new byte[1024*4]; // copy data in 4MB-chunks
476 while((i = is.read(buffer)) > -1)
477 digest.update(buffer, 0, i);
479 byte[] bytes = digest.digest();
480 BigInteger bi = new BigInteger(1, bytes);
481 String newMd5 = String.format("%0" + (bytes.length << 1) + "x", bi);
482 String oldMd5 = !md5s.containsKey(name) ? "" : md5s.get(name);
483 if (!newMd5.equals(oldMd5))
485 getLog().debug("Found new or modified annotated class: " + name);
487 md5s.put(name, newMd5);
491 getLog().debug(oldMd5 + " -> class unchanged: " + name);
495 catch (ClassNotFoundException e)
497 getLog().error("Error while adding annotated classes!", e);
498 throw new MojoExecutionException(e.getMessage());
502 getLog().error("Error while scanning!", e);
503 throw new MojoFailureException(e.getMessage());
506 if (classes.isEmpty())
508 if (hibernateMapping == null || hibernateMapping.isEmpty())
509 throw new MojoFailureException("No annotated classes found in directory " + outputDirectory);
513 getLog().debug("Detected classes with mapping-annotations:");
514 for (Class<?> annotatedClass : classes)
515 getLog().debug(" " + annotatedClass.getName());
519 Properties properties = new Properties();
521 /** Try to read configuration from properties-file */
524 File file = new File(hibernateProperties);
527 getLog().info("Reading properties from file " + hibernateProperties + "...");
528 properties.load(new FileInputStream(file));
531 getLog().info("No hibernate-properties-file found! (Checked path: " + hibernateProperties + ")");
533 catch (IOException e)
535 getLog().error("Error while reading properties!", e);
536 throw new MojoExecutionException(e.getMessage());
539 /** Overwrite values from propertie-file or set, if given */
540 if (driverClassName != null)
542 if (properties.containsKey(DRIVER_CLASS))
544 "Overwriting property " +
545 DRIVER_CLASS + "=" + properties.getProperty(DRIVER_CLASS) +
546 " with the value " + driverClassName
549 getLog().debug("Using the value " + driverClassName);
550 properties.setProperty(DRIVER_CLASS, driverClassName);
554 if (properties.containsKey(URL))
556 "Overwriting property " +
557 URL + "=" + properties.getProperty(URL) +
558 " with the value " + url
561 getLog().debug("Using the value " + url);
562 properties.setProperty(URL, url);
564 if (username != null)
566 if (properties.containsKey(USERNAME))
568 "Overwriting property " +
569 USERNAME + "=" + properties.getProperty(USERNAME) +
570 " with the value " + username
573 getLog().debug("Using the value " + username);
574 properties.setProperty(USERNAME, username);
576 if (password != null)
578 if (properties.containsKey(PASSWORD))
580 "Overwriting property " +
581 PASSWORD + "=" + properties.getProperty(PASSWORD) +
582 " with value " + password
585 getLog().debug("Using value " + password + " for property " + PASSWORD);
586 properties.setProperty(PASSWORD, password);
588 if (hibernateDialect != null)
590 if (properties.containsKey(DIALECT))
592 "Overwriting property " +
593 DIALECT + "=" + properties.getProperty(DIALECT) +
594 " with value " + hibernateDialect
598 "Using value " + hibernateDialect + " for property " + DIALECT
600 properties.setProperty(DIALECT, hibernateDialect);
602 if ( hibernateNamingStrategy != null )
604 if ( properties.contains(NAMING_STRATEGY))
606 "Overwriting property " +
607 NAMING_STRATEGY + "=" + properties.getProperty(NAMING_STRATEGY) +
608 " with value " + hibernateNamingStrategy
612 "Using value " + hibernateNamingStrategy + " for property " +
615 properties.setProperty(NAMING_STRATEGY, hibernateNamingStrategy);
618 /** The generated SQL varies with the dialect! */
619 if (md5s.containsKey(DIALECT))
621 String dialect = properties.getProperty(DIALECT);
622 if (md5s.get(DIALECT).equals(dialect))
623 getLog().debug("SQL-dialect unchanged.");
629 getLog().debug("SQL-dialect was unset.");
630 md5s.remove(DIALECT);
634 getLog().debug("SQL-dialect changed: " + dialect);
635 md5s.put(DIALECT, dialect);
641 String dialect = properties.getProperty(DIALECT);
645 md5s.put(DIALECT, properties.getProperty(DIALECT));
649 /** The generated SQL varies with the envers-configuration */
650 if (md5s.get(ENVERS) != null)
652 if (md5s.get(ENVERS).equals(Boolean.toString(envers)))
653 getLog().debug("Envers-Configuration unchanged. Enabled: " + envers);
656 getLog().debug("Envers-Configuration changed. Enabled: " + envers);
658 md5s.put(ENVERS, Boolean.toString(envers));
664 md5s.put(ENVERS, Boolean.toString(envers));
667 if (properties.isEmpty())
669 getLog().error("No properties set!");
670 throw new MojoFailureException("Hibernate-Configuration is missing!");
673 Configuration config = new Configuration();
674 config.setProperties(properties);
676 if ( properties.containsKey(NAMING_STRATEGY))
678 String namingStrategy = properties.getProperty(NAMING_STRATEGY);
679 getLog().debug("Explicitly set NamingStrategy: " + namingStrategy);
682 @SuppressWarnings("unchecked")
683 Class<NamingStrategy> namingStrategyClass = (Class<NamingStrategy>) Class.forName(namingStrategy);
684 config.setNamingStrategy(namingStrategyClass.newInstance());
688 getLog().error("Error setting NamingStrategy", e);
689 throw new MojoExecutionException(e.getMessage());
693 getLog().debug("Adding annotated classes to hibernate-mapping-configuration...");
694 for (Class<?> annotatedClass : classes)
696 getLog().debug("Class " + annotatedClass);
697 config.addAnnotatedClass(annotatedClass);
700 if (hibernateMapping != null)
704 MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
705 for (String filename : hibernateMapping.split("[\\s,]+"))
707 // First try the filename as absolute/relative path
708 File file = new File(filename);
711 // If the file was not found, search for it in the resource-directories
712 for (Resource resource : project.getResources())
714 file = new File(resource.getDirectory() + File.separator + filename);
719 if (file != null && file.exists())
721 InputStream is = new FileInputStream(file);
722 byte[] buffer = new byte[1024*4]; // copy data in 4MB-chunks
724 while((i = is.read(buffer)) > -1)
725 digest.update(buffer, 0, i);
727 byte[] bytes = digest.digest();
728 BigInteger bi = new BigInteger(1, bytes);
729 String newMd5 = String.format("%0" + (bytes.length << 1) + "x", bi);
730 String oldMd5 = !md5s.containsKey(filename) ? "" : md5s.get(filename);
731 if (!newMd5.equals(oldMd5))
733 getLog().debug("Found new or modified mapping-file: " + filename);
735 md5s.put(filename, newMd5);
739 getLog().debug(oldMd5 + " -> mapping-file unchanged: " + filename);
741 getLog().debug("Adding mappings from XML-configurationfile: " + file);
742 config.addFile(file);
745 throw new MojoFailureException("File " + filename + " could not be found in any of the configured resource-directories!");
748 catch (NoSuchAlgorithmException e)
750 throw new MojoFailureException("Cannot calculate MD5-summs!", e);
752 catch (FileNotFoundException e)
754 throw new MojoFailureException("Cannot calculate MD5-summs!", e);
756 catch (IOException e)
758 throw new MojoFailureException("Cannot calculate MD5-summs!", e);
762 Target target = null;
765 target = Target.valueOf(this.target.toUpperCase());
767 catch (IllegalArgumentException e)
769 getLog().error("Invalid value for configuration-option \"target\": " + this.target);
770 getLog().error("Valid values are: NONE, SCRIPT, EXPORT, BOTH");
771 throw new MojoExecutionException("Invalid value for configuration-option \"target\"");
776 type = Type.valueOf(this.type.toUpperCase());
778 catch (IllegalArgumentException e)
780 getLog().error("Invalid value for configuration-option \"type\": " + this.type);
781 getLog().error("Valid values are: NONE, CREATE, DROP, BOTH");
782 throw new MojoExecutionException("Invalid value for configuration-option \"type\"");
785 if (target.equals(Target.SCRIPT) || target.equals(Target.NONE))
787 project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true");
791 && !target.equals(Target.SCRIPT)
792 && !target.equals(Target.NONE)
796 getLog().info("No modified annotated classes or mapping-files found and dialect unchanged.");
797 getLog().info("Skipping schema generation!");
798 project.getProperties().setProperty(EXPORT_SKIPPED_PROPERTY, "true");
802 getLog().info("Gathered hibernate-configuration (turn on debugging for details):");
803 for (Entry<Object,Object> entry : properties.entrySet())
804 getLog().info(" " + entry.getKey() + " = " + entry.getValue());
806 Connection connection = null;
810 * The connection must be established outside of hibernate, because
811 * hibernate does not use the context-classloader of the current
812 * thread and, hence, would not be able to resolve the driver-class!
814 getLog().debug("Target: " + target + ", Type: " + type);
824 Class driverClass = classLoader.loadClass(properties.getProperty(DRIVER_CLASS));
825 getLog().debug("Registering JDBC-driver " + driverClass.getName());
826 DriverManager.registerDriver(new DriverProxy((Driver)driverClass.newInstance()));
828 "Opening JDBC-connection to "
829 + properties.getProperty(URL)
831 + properties.getProperty(USERNAME)
833 + properties.getProperty(PASSWORD)
835 connection = DriverManager.getConnection(
836 properties.getProperty(URL),
837 properties.getProperty(USERNAME),
838 properties.getProperty(PASSWORD)
843 catch (ClassNotFoundException e)
845 getLog().error("Dependency for driver-class " + properties.getProperty(DRIVER_CLASS) + " is missing!");
846 throw new MojoExecutionException(e.getMessage());
850 getLog().error("Cannot establish connection to database!");
851 Enumeration<Driver> drivers = DriverManager.getDrivers();
852 if (!drivers.hasMoreElements())
853 getLog().error("No drivers registered!");
854 while (drivers.hasMoreElements())
855 getLog().debug("Driver: " + drivers.nextElement());
856 throw new MojoExecutionException(e.getMessage());
859 ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
860 MavenLogAppender.startPluginLog(this);
864 * Change class-loader of current thread, so that hibernate can
865 * see all dependencies!
867 Thread.currentThread().setContextClassLoader(classLoader);
869 config.buildMappings();
873 getLog().info("Automatic auditing via hibernate-envers enabled!");
874 AuditConfiguration.getFor(config);
877 SchemaExport export = new SchemaExport(config, connection);
878 export.setOutputFile(outputFile);
879 export.setDelimiter(delimiter);
880 export.setFormat(format);
881 export.execute(target, type);
883 for (Object exception : export.getExceptions())
884 getLog().debug(exception.toString());
888 /** Stop Log-Capturing */
889 MavenLogAppender.endPluginLog(this);
891 /** Restore the old class-loader (TODO: is this really necessary?) */
892 Thread.currentThread().setContextClassLoader(contextClassLoader);
894 /** Close the connection */
897 if (connection != null)
900 catch (SQLException e)
902 getLog().error("Error while closing connection: " + e.getMessage());
906 /** Write md5-sums for annotated classes to file */
909 FileOutputStream fos = new FileOutputStream(saved);
910 ObjectOutputStream oos = new ObjectOutputStream(fos);
911 oos.writeObject(md5s);
917 getLog().error("Cannot write md5-sums to file: " + e);
922 * Needed, because DriverManager won't pick up drivers, that were not
923 * loaded by the system-classloader!
925 * http://stackoverflow.com/questions/288828/how-to-use-a-jdbc-driver-fromodifiedm-an-arbitrary-location
927 static final class DriverProxy implements Driver
929 private final Driver target;
931 DriverProxy(Driver target)
934 throw new NullPointerException();
935 this.target = target;
938 public java.sql.Driver getTarget()
944 public boolean acceptsURL(String url) throws SQLException
946 return target.acceptsURL(url);
950 public java.sql.Connection connect(
952 java.util.Properties info
957 return target.connect(url, info);
961 public int getMajorVersion()
963 return target.getMajorVersion();
967 public int getMinorVersion()
969 return target.getMinorVersion();
973 public DriverPropertyInfo[] getPropertyInfo(
980 return target.getPropertyInfo(url, info);
984 public boolean jdbcCompliant()
986 return target.jdbcCompliant();
990 * This Method cannot be annotated with @Override, becaus the plugin
991 * will not compile then under Java 1.6!
993 public Logger getParentLogger() throws SQLFeatureNotSupportedException
995 throw new SQLFeatureNotSupportedException("Not supported, for backward-compatibility with Java 1.6");
999 public String toString()
1001 return "Proxy: " + target;
1005 public int hashCode()
1007 return target.hashCode();
1011 public boolean equals(Object obj)
1013 if (!(obj instanceof DriverProxy))
1015 DriverProxy other = (DriverProxy) obj;
1016 return this.target.equals(other.target);