Re: svn commit: r764019 - /cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Apr 11 2009 - 05:51:58 EDT

  • Next message: Andrus Adamchik: "Re: maven plugin for importing DB schema"

    > I like final.

    Why? Is there any proof of better performance if you declare local
    variables as final? Otherwise this seems like cluttering the code.

    Andrus

    On Apr 10, 2009, at 10:49 PM, kmenar..pache.org wrote:

    > Author: kmenard
    > Date: Fri Apr 10 19:49:55 2009
    > New Revision: 764019
    >
    > URL: http://svn.apache.org/viewvc?rev=764019&view=rev
    > Log:
    > I like final.
    >
    > Modified:
    > cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/
    > org/apache/cayenne/tools/DbImporterMojo.java
    >
    > Modified: cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/
    > java/org/apache/cayenne/tools/DbImporterMojo.java
    > URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbImporterMojo.java?rev=764019&r1=764018&r2=764019&view=diff
    > =
    > =
    > =
    > =
    > =
    > =
    > =
    > =
    > ======================================================================
    > --- cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/
    > org/apache/cayenne/tools/DbImporterMojo.java (original)
    > +++ cayenne/main/trunk/framework/maven-cayenne-plugin/src/main/java/
    > org/apache/cayenne/tools/DbImporterMojo.java Fri Apr 10 19:49:55 2009
    >.. -112,15 +112,15 @@
    > final DbLoader loader = new
    > DbLoader(dataSource.getConnection(), adapterInst, new
    > LoaderDelegate());
    >
    > mapFile = new File(map);
    > - DataMap dataMap = mapFile.exists() ? loadDataMap() :
    > new DataMap();
    > + final DataMap dataMap = mapFile.exists() ?
    > loadDataMap() : new DataMap();
    > loader.loadDataMapFromDB(schemaName, tablePattern,
    > dataMap);
    >
    > mapFile.delete();
    > PrintWriter pw = new PrintWriter(mapFile);
    > dataMap.encodeAsXML(pw);
    > pw.close();
    > - } catch (Exception ex) {
    > - Throwable th = Util.unwindException(ex);
    > + } catch (final Exception ex) {
    > + final Throwable th = Util.unwindException(ex);
    >
    > String message = "Error importing database schema";
    >
    >.. -135,26 +135,26 @@
    >
    > final class LoaderDelegate implements DbLoaderDelegate {
    >
    > - public boolean overwriteDbEntity(DbEntity ent) throws
    > CayenneException {
    > + public boolean overwriteDbEntity(final DbEntity ent) throws
    > CayenneException {
    > return true;
    > }
    >
    > - public void dbEntityAdded(DbEntity ent) {
    > + public void dbEntityAdded(final DbEntity ent) {
    > logger.info("Added DB entity: " + ent.getName());
    > ent.getDataMap().addDbEntity(ent);
    > }
    >
    > - public void dbEntityRemoved(DbEntity ent) {
    > + public void dbEntityRemoved(final DbEntity ent) {
    > logger.info("Removed DB entity: " + ent.getName());
    > ent.getDataMap().removeDbEntity(ent.getName());
    > }
    >
    > - public void objEntityAdded(ObjEntity ent) {
    > + public void objEntityAdded(final ObjEntity ent) {
    > logger.info("Added obj entity: " + ent.getName());
    > ent.getDataMap().addObjEntity(ent);
    > }
    >
    > - public void objEntityRemoved(ObjEntity ent) {
    > + public void objEntityRemoved(final ObjEntity ent) {
    > logger.info("Removed obj entity: " + ent.getName());
    > ent.getDataMap().removeObjEntity(ent.getName());
    > }
    >.. -162,7 +162,7 @@
    >
    > /** Loads and returns DataMap based on <code>map</code>
    > attribute. */
    > protected DataMap loadDataMap() throws Exception {
    > - InputSource in = new InputSource(mapFile.getCanonicalPath());
    > + final InputSource in = new
    > InputSource(mapFile.getCanonicalPath());
    > return new MapLoader().loadDataMap(in);
    > }
    > }
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Apr 11 2009 - 05:52:32 EDT