Revision: 3286
Author: [email protected]
Date: Thu Feb 11 11:47:13 2010
Log: NEW - bug 2697: Remove the SPPersisterHelperFactoryImpl
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2697

Corrected the annotations on the classes extending SPObject. This allows the change to the build.xml to create persister helpers based on the new annotations. There is currently one test in the regress package for the ArchitectProject but
more are to come soon.
The persister helpers can be created by running the compile target in the build.xml. Currently there are unused imports
which cause errors in Eclipse but this will be fixed soon.
http://code.google.com/p/power-architect/source/detail?r=3286

Added:
 /trunk/lib/google-collections-1.0-rc4.jar
 /trunk/regress/ca/sqlpower/architect/ArchitectProjectTest.java
 /trunk/regress/ca/sqlpower/architect/StubArchitectSession.java
/trunk/src/ca/sqlpower/architect/enterprise/ArchitectPersisterSuperConverter.java
Modified:
 /trunk/.classpath
 /trunk/build.xml
 /trunk/src/ca/sqlpower/architect
 /trunk/src/ca/sqlpower/architect/ArchitectProject.java
 /trunk/src/ca/sqlpower/architect/ArchitectSessionImpl.java
 /trunk/src/ca/sqlpower/architect/ddl
 /trunk/src/ca/sqlpower/architect/ddl/DDLStatement.java
 /trunk/src/ca/sqlpower/architect/profile
 /trunk/src/ca/sqlpower/architect/profile/ColumnProfileResult.java
 /trunk/src/ca/sqlpower/architect/profile/ColumnValueCount.java
 /trunk/src/ca/sqlpower/architect/profile/ProfileManagerImpl.java
 /trunk/src/ca/sqlpower/architect/profile/TableProfileResult.java

=======================================
--- /dev/null   
+++ /trunk/lib/google-collections-1.0-rc4.jar   Thu Feb 11 11:47:13 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/regress/ca/sqlpower/architect/ArchitectProjectTest.java Thu Feb 11 11:47:13 2010
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2010, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ca.sqlpower.architect;
+
+import ca.sqlpower.architect.enterprise.ArchitectPersisterSuperConverter;
+import ca.sqlpower.architect.profile.ProfileManagerImpl;
+import ca.sqlpower.dao.session.SessionPersisterSuperConverter;
+import ca.sqlpower.object.PersistedSPObjectTest;
+import ca.sqlpower.object.SPObject;
+
+public class ArchitectProjectTest extends PersistedSPObjectTest {
+
+    private ArchitectProject objectUnderTest;
+
+    public ArchitectProjectTest(String name) {
+        super(name);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        objectUnderTest = new ArchitectProject(new StubArchitectSession());
+        getRootObject().addChild(objectUnderTest, 0);
+    }
+
+    @Override
+    protected Class<? extends SPObject> getChildClassType() {
+        return null;
+    }
+
+    @Override
+    public SPObject getSPObjectUnderTest() {
+        return objectUnderTest;
+    }
+
+    @Override
+    public SessionPersisterSuperConverter getConverter() {
+ return new ArchitectPersisterSuperConverter(getPLIni(), getRootObject());
+    }
+
+    /**
+ * Minor test to ensure the child position offset does allow children that
+     * are subclasses of child types it allows.
+     */
+    public void testChildPositionOffset() throws Exception {
+ assertEquals(1, objectUnderTest.childPositionOffset(ProfileManagerImpl.class));
+    }
+
+    @Override
+    public void testPersisterCreatesNewObjects() throws Exception {
+        //The ArchitectProject is the root of the SPObject tree. This
+        //object cannot be made straight from persist calls but must exist
+        //as part of the session to start.
+    }
+
+    @Override
+    public void testSPListenerPersistsNewObjects() throws Exception {
+      //The ArchitectProject is the root of the SPObject tree. This
+        //object cannot be made straight from persist calls but must exist
+        //as part of the session to start.
+    }
+
+}
=======================================
--- /dev/null
+++ /trunk/regress/ca/sqlpower/architect/StubArchitectSession.java Thu Feb 11 11:47:13 2010
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2010, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ca.sqlpower.architect;
+
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import ca.sqlpower.architect.ddl.DDLGenerator;
+import ca.sqlpower.architect.profile.ProfileManager;
+import ca.sqlpower.sql.DataSourceCollection;
+import ca.sqlpower.sql.JDBCDataSource;
+import ca.sqlpower.sql.SPDataSource;
+import ca.sqlpower.sqlobject.SQLDatabase;
+import ca.sqlpower.sqlobject.SQLObjectException;
+import ca.sqlpower.sqlobject.SQLObjectRoot;
+import ca.sqlpower.swingui.event.SessionLifecycleListener;
+import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
+import ca.sqlpower.util.UserPrompter.UserPromptResponse;
+
+public class StubArchitectSession implements ArchitectSession {
+
+    public void addPropertyChangeListener(PropertyChangeListener l) {
+        // TODO Auto-generated method stub
+
+    }
+
+ public void addSessionLifecycleListener(SessionLifecycleListener<ArchitectSession> l) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public boolean close() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public ArchitectSessionContext getContext() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public DDLGenerator getDDLGenerator() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ProfileManager getProfileManager() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ProjectLoader getProjectLoader() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public SQLObjectRoot getRootObject() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public SQLDatabase getTargetDatabase() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public ArchitectProject getWorkspace() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void removePropertyChangeListener(PropertyChangeListener l) {
+        // TODO Auto-generated method stub
+
+    }
+
+ public void removeSessionLifecycleListener(SessionLifecycleListener<ArchitectSession> l) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setDDLGenerator(DDLGenerator generator) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setName(String argName) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setProjectLoader(ProjectLoader project) {
+        // TODO Auto-generated method stub
+
+    }
+
+ public void setSourceDatabaseList(List<SQLDatabase> databases) throws SQLObjectException {
+        // TODO Auto-generated method stub
+
+    }
+
+ public UserPrompter createDatabaseUserPrompter(String question, List<Class<? extends SPDataSource>> dsTypes, + UserPromptOptions optionType, UserPromptResponse defaultResponseType, Object defaultResponse, + DataSourceCollection<SPDataSource> dsCollection, String... buttonNames) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+ public UserPrompter createUserPrompter(String question, UserPromptType responseType, UserPromptOptions optionType, + UserPromptResponse defaultResponseType, Object defaultResponse, String... buttonNames) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public SQLDatabase getDatabase(JDBCDataSource ds) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean isForegroundThread() {
+        return true;
+    }
+
+    public void runInBackground(Runnable runner) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void runInForeground(Runnable runner) {
+        // TODO Auto-generated method stub
+
+    }
+
+}
=======================================
--- /dev/null
+++ /trunk/src/ca/sqlpower/architect/enterprise/ArchitectPersisterSuperConverter.java Thu Feb 11 11:47:13 2010
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ca.sqlpower.architect.enterprise;
+
+import ca.sqlpower.dao.session.SessionPersisterSuperConverter;
+import ca.sqlpower.object.SPObject;
+import ca.sqlpower.sql.DataSourceCollection;
+import ca.sqlpower.sql.SPDataSource;
+
+/**
+ * This converter contains specific conversions for Architect objects. This will
+ * still convert types in the base class.
+ */
+public class ArchitectPersisterSuperConverter extends SessionPersisterSuperConverter {
+
+ public ArchitectPersisterSuperConverter(DataSourceCollection<? extends SPDataSource> dsCollection, SPObject root) {
+        super(dsCollection, root);
+    }
+
+    @Override
+ public Object convertToBasicType(Object convertFrom, Object... additionalInfo) {
+        return super.convertToBasicType(convertFrom, additionalInfo);
+    }
+
+    @Override
+ public Object convertToComplexType(Object o, Class<? extends Object> type) {
+        return super.convertToComplexType(o, type);
+    }
+
+}
=======================================
--- /trunk/.classpath   Tue Feb  9 07:36:02 2010
+++ /trunk/.classpath   Thu Feb 11 11:47:13 2010
@@ -42,6 +42,7 @@
        <classpathentry kind="lib" path="lib/kettle-core-3.2.2.jar"/>
        <classpathentry kind="lib" path="lib/kettle-db-3.2.2.jar"/>
        <classpathentry kind="lib" path="lib/commons-lang-2.4.jar"/>
+       <classpathentry kind="lib" path="lib/google-collections-1.0-rc4.jar"/>
        <classpathentry kind="lib" path="lib/httpclient-4.0.jar"/>
        <classpathentry kind="lib" path="lib/httpcore-4.0.1.jar"/>
        <classpathentry kind="lib" path="lib/jmdns-2.1.jar"/>
=======================================
--- /trunk/build.xml    Tue Feb  9 07:27:50 2010
+++ /trunk/build.xml    Thu Feb 11 11:47:13 2010
@@ -26,6 +26,11 @@
             get added to the architect.jar file. -->
        <property name="build" value="build"/>

+       <!-- A target build directory to place a temporary build in to
+            allow us to generate new files based on the annotations in the
+            class files. -->
+       <property name="build_tmp" value="build_tmp"/>
+
        <property name="dist.base" value="dist"/>

        <!-- The target build directory for compiled test classes.
@@ -54,6 +59,13 @@

        <property name="only.copy.sqlpower.library" value="false"/>

+    <path id="apt.classpath">
+           <pathelement location="${build}"/>
+           <fileset dir="lib">
+               <include name="*.jar"/>
+           </fileset>
+       </path>
+
        <!-- When the build runs on a Mac, we can create the .dmg disk image
             using the native hdiutil program.  Otherwise, we just make a 
.tar.gz.
        -->
@@ -383,9 +395,30 @@

        <!-- Compiles the application source files -->
<target name="compile" depends="init, copyfiles, build.sqlpower.library, copy.sqlpower.library">
-               <javac srcdir="${src}" destdir="${build}"
-                       classpathref="compile.classpath"
-                       debug="true"/>
+               <mkdir dir="${build_tmp}"/>
+ <javac srcdir="${src}" destdir="${build}" classpathref="compile.classpath" debug="true"/>
+               <apt srcdir="${src}"
+            destdir="${build_tmp}"
+            classpathref="apt.classpath"
+            debug="true"
+            compile="true"
+ factory="ca.sqlpower.object.annotation.SPAnnotationProcessorFactory"
+            preprocessdir="src">
+        </apt>
+        <delete dir="${build}"/>
+        <move todir="${build}">
+            <fileset dir="${build_tmp}"/>
+        </move>
+        <copy todir="${build}">
+            <fileset dir="${src}">
+                <include name="**/*.png"/>
+            </fileset>
+        </copy>
+        <copy todir="${build}/">
+            <fileset dir="src">
+                <include name="**/messages*.properties"/>
+            </fileset>
+           </copy>
        </target>

        <target name="compile-tests" depends="compile"
=======================================
--- /trunk/src/ca/sqlpower/architect/ArchitectProject.java Wed Feb 10 07:55:16 2010 +++ /trunk/src/ca/sqlpower/architect/ArchitectProject.java Thu Feb 11 11:47:13 2010
@@ -21,16 +21,22 @@

 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;

 import ca.sqlpower.architect.ddl.DDLGenerator;
 import ca.sqlpower.architect.ddl.GenericDDLGenerator;
 import ca.sqlpower.architect.profile.ProfileManager;
-import ca.sqlpower.architect.profile.ProfileManagerImpl;
 import ca.sqlpower.object.AbstractSPObject;
 import ca.sqlpower.object.ObjectDependentException;
 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Accessor;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;
+import ca.sqlpower.object.annotation.NonBound;
+import ca.sqlpower.object.annotation.NonProperty;
+import ca.sqlpower.object.annotation.Transient;
 import ca.sqlpower.sql.JDBCDataSource;
 import ca.sqlpower.sqlobject.SQLDatabase;
 import ca.sqlpower.sqlobject.SQLObject;
@@ -49,14 +55,24 @@

 public class ArchitectProject extends AbstractSPObject {

+    /**
+     * Defines an absolute ordering of the child types of this class.
+     */
+    @SuppressWarnings("unchecked")
+    public static List<Class<? extends SPObject>> allowedChildTypes =
+ Collections.unmodifiableList(new ArrayList<Class<? extends SPObject>>( + Arrays.asList(SQLObjectRoot.class, ProfileManager.class, DDLGenerator.class, SQLDatabase.class)));
+
     private final ArchitectSession session;
     private SQLObjectRoot rootObject;
-    private ProfileManagerImpl profileManager;
+    private ProfileManager profileManager;
     private SQLDatabase db;

     private DDLGenerator ddlGenerator;

- public ArchitectProject(ArchitectSession session) throws SQLObjectException {
+    @Constructor
+ public ArchitectProject(@ConstructorParameter(propertyName="session") ArchitectSession session)
+            throws SQLObjectException {
         this.session = session;
         this.rootObject = new SQLObjectRoot();
         this.db = new SQLDatabase();
@@ -79,14 +95,17 @@
      * Returns the top level object in the SQLObject hierarchy.
      * It has no parent and its children are SQLDatabase's.
      */
+    @NonProperty
     public SQLObjectRoot getRootObject() {
         return rootObject;
     }

-    public ProfileManagerImpl getProfileManager() {
+    @NonProperty
+    public ProfileManager getProfileManager() {
         return profileManager;
     }

+    @NonProperty
     public SQLDatabase getDatabase(JDBCDataSource ds) {
         try {
for (SQLDatabase obj : getRootObject().getChildren(SQLDatabase.class)) {
@@ -105,14 +124,17 @@
         }
     }

+    @NonProperty
     public SQLDatabase getTargetDatabase() {
         return db;
     }

+    @NonProperty
     public DDLGenerator getDDLGenerator() {
         return ddlGenerator;
     }

+    @NonProperty
public void setSourceDatabaseList(List<SQLDatabase> databases) throws SQLObjectException {
         SQLObject root = getRootObject();
         try {
@@ -133,12 +155,24 @@
         }
     }

+    @NonProperty
     public void setDDLGenerator(DDLGenerator generator) {
+        DDLGenerator oldDDLG = ddlGenerator;
         ddlGenerator = generator;
+        if (oldDDLG != null) {
+            fireChildRemoved(DDLGenerator.class, oldDDLG, 0);
+        }
+        fireChildAdded(DDLGenerator.class, generator, 0);
     }

-    public void setProfileManager(ProfileManagerImpl manager) {
+    @NonProperty
+    public void setProfileManager(ProfileManager manager) {
+        ProfileManager oldManager = profileManager;
         profileManager = manager;
+        if (oldManager != null) {
+            fireChildRemoved(ProfileManager.class, oldManager, 0);
+        }
+        fireChildAdded(ProfileManager.class, manager, 0);
     }

     @Override
@@ -146,6 +180,7 @@
         return false;
     }

+    @Transient @Accessor
     public SPSession getSession() {
         return session;
     }
@@ -156,28 +191,25 @@

     public int childPositionOffset(Class<? extends SPObject> childType) {

-        if (childType.isAssignableFrom(SQLObjectRoot.class)) {
+        if (SQLObjectRoot.class.isAssignableFrom(childType)) {
             return 0;
-        } else if (childType.isAssignableFrom(ProfileManager.class)) {
+        } else if (ProfileManager.class.isAssignableFrom(childType)) {
             return 1;
-        } else if (childType.isAssignableFrom(DDLGenerator.class)) {
+        } else if (DDLGenerator.class.isAssignableFrom(childType)) {
             return 2;
-        } else if (childType.isAssignableFrom(SQLDatabase.class)) {
+        } else if (SQLDatabase.class.isAssignableFrom(childType)) {
             return 3;
         } else {
             throw new IllegalArgumentException();
         }
     }

+    @Transient @Accessor
     public List<Class<? extends SPObject>> getAllowedChildTypes() {
- List<Class<? extends SPObject>> childTypes = new ArrayList<Class<? extends SPObject>>();
-        childTypes.add(SQLObjectRoot.class);
-        childTypes.add(ProfileManager.class);
-        childTypes.add(DDLGenerator.class);
-        childTypes.add(SQLDatabase.class);
-        return childTypes;
+        return allowedChildTypes;
     }

+    @NonProperty
     public List<SPObject> getChildren() {
         List<SPObject> allChildren = new ArrayList<SPObject>();
         allChildren.add(rootObject);
@@ -186,13 +218,17 @@
         allChildren.add(db);
         return allChildren;
     }
-
+
+    @NonBound
     public List<? extends SPObject> getDependencies() {
         return Collections.emptyList();
     }

     public void removeDependency(SPObject dependency) {
-
+        db.removeDependency(dependency);
+        rootObject.removeDependency(dependency);
+        profileManager.removeDependency(dependency);
+        ddlGenerator.removeDependency(dependency);
     }

     protected void addChildImpl(SPObject child, int index) {
=======================================
--- /trunk/src/ca/sqlpower/architect/ArchitectSessionImpl.java Thu Jan 28 12:23:16 2010 +++ /trunk/src/ca/sqlpower/architect/ArchitectSessionImpl.java Thu Feb 11 11:47:13 2010
@@ -25,6 +25,7 @@
 import java.util.List;

 import ca.sqlpower.architect.ddl.DDLGenerator;
+import ca.sqlpower.architect.profile.ProfileManager;
 import ca.sqlpower.architect.profile.ProfileManagerImpl;
 import ca.sqlpower.sql.DataSourceCollection;
 import ca.sqlpower.sql.JDBCDataSource;
@@ -106,7 +107,7 @@
         this.name = argName;
     }

-    public ProfileManagerImpl getProfileManager() {
+    public ProfileManager getProfileManager() {
         return project.getProfileManager();
     }

=======================================
--- /trunk/src/ca/sqlpower/architect/ddl/DDLStatement.java Mon Jan 18 11:55:38 2010 +++ /trunk/src/ca/sqlpower/architect/ddl/DDLStatement.java Thu Feb 11 11:47:13 2010
@@ -23,6 +23,10 @@

 import ca.sqlpower.object.AbstractSPObject;
 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Accessor;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;
+import ca.sqlpower.object.annotation.Mutator;
 import ca.sqlpower.sqlobject.SQLObject;

 /**
@@ -75,13 +79,14 @@
        private String sqlText;
        private String sqlTerminator;

+       @Constructor
        public DDLStatement(
-               SQLObject object,
-               StatementType type,
-               String sqlText,
-               String sqlTerminator,
-               String targetCatalog,
-               String targetSchema) {
+               @ConstructorParameter(propertyName="object") SQLObject object,
+               @ConstructorParameter(propertyName="type") StatementType type,
+               @ConstructorParameter(propertyName="SQLText") String sqlText,
+ @ConstructorParameter(propertyName="sqlTerminator") String sqlTerminator, + @ConstructorParameter(propertyName="targetCatalog") String targetCatalog, + @ConstructorParameter(propertyName="targetSchema") String targetSchema) {
            this.object = object;
            this.type = type;
            this.sqlText = sqlText;
@@ -97,6 +102,7 @@
         *
         * @return the value of object
         */
+       @Accessor
        public SQLObject getObject()  {
                return this.object;
        }
@@ -106,8 +112,11 @@
         *
         * @param argObject Value to assign to this.object
         */
+       @Mutator
        public void setObject(SQLObject argObject) {
+           SQLObject oldObj = object;
                this.object = argObject;
+               firePropertyChange("object", oldObj, argObject);
        }

        /**
@@ -115,6 +124,7 @@
         *
         * @return the value of type
         */
+       @Accessor
        public StatementType getType()  {
                return this.type;
        }
@@ -124,8 +134,11 @@
         *
         * @param argType Value to assign to this.type
         */
+       @Mutator
        public void setType(StatementType argType) {
+           StatementType oldType = type;
                this.type = argType;
+               firePropertyChange("type", oldType, type);
        }

        /**
@@ -133,6 +146,7 @@
         *
         * @return the value of sqlText
         */
+       @Accessor
        public String getSQLText()  {
                return this.sqlText;
        }
@@ -142,29 +156,47 @@
         *
         * @param v Value to assign to this.sqlText
         */
+       @Mutator
        public void setSQLText(String v) {
+           String oldText = sqlText;
                this.sqlText = v;
+               firePropertyChange("SQLText", oldText, v);
        }

+       @Mutator
     public void setSqlTerminator(String sqlTerminator) {
+           String oldTerminator = this.sqlTerminator;
         this.sqlTerminator = sqlTerminator;
+        firePropertyChange("sqlTerminator", oldTerminator, sqlTerminator);
     }

+    @Accessor
     public String getSqlTerminator() {
         return sqlTerminator;
     }

+    @Accessor
        public String getTargetCatalog() {
                return targetCatalog;
        }
+
+    @Mutator
        public void setTargetCatalog(String targetCatalog) {
+        String oldCatalog = this.targetCatalog;
                this.targetCatalog = targetCatalog;
-       }
+               firePropertyChange("targetCatalog", oldCatalog, targetCatalog);
+       }
+
+       @Accessor
        public String getTargetSchema() {
                return targetSchema;
        }
+
+       @Mutator
        public void setTargetSchema(String targetSchema) {
+           String oldSchema = this.targetSchema;
                this.targetSchema = targetSchema;
+               firePropertyChange("targetSchema", oldSchema, targetSchema);
        }

     public String toString() {
=======================================
--- /trunk/src/ca/sqlpower/architect/profile/ColumnProfileResult.java Mon Jan 18 11:01:49 2010 +++ /trunk/src/ca/sqlpower/architect/profile/ColumnProfileResult.java Thu Feb 11 11:47:13 2010
@@ -24,6 +24,8 @@
 import org.apache.log4j.Logger;

 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;
 import ca.sqlpower.sqlobject.SQLColumn;

 public class ColumnProfileResult extends AbstractProfileResult<SQLColumn> {
@@ -45,7 +47,9 @@
     /**
* This creates a column profile result which stores information about a profiled column.
      */
- public ColumnProfileResult(SQLColumn profiledObject, TableProfileResult parentResult) {
+    @Constructor
+ public ColumnProfileResult(@ConstructorParameter(propertyName="profiledObject") SQLColumn profiledObject, + @ConstructorParameter(propertyName="parentResult") TableProfileResult parentResult) {
         super(profiledObject);
         this.parentResult = parentResult;
     }
=======================================
--- /trunk/src/ca/sqlpower/architect/profile/ColumnValueCount.java Mon Jan 18 09:19:18 2010 +++ /trunk/src/ca/sqlpower/architect/profile/ColumnValueCount.java Thu Feb 11 11:47:13 2010
@@ -23,6 +23,8 @@

 import ca.sqlpower.object.AbstractSPObject;
 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;

 /**
  * A simple class for keeping track of a value, the number of occurrences
@@ -46,7 +48,10 @@
      * being profiled.
      * @param percent The percentage of occurrences in the table.
      */
-    public ColumnValueCount(Object value, int count, double percent) {
+    @Constructor
+ public ColumnValueCount(@ConstructorParameter(propertyName="value") Object value,
+            @ConstructorParameter(propertyName="count") int count,
+            @ConstructorParameter(propertyName="percent") double percent) {
         this.value = value;
         this.count = count;
         this.percent = percent;
=======================================
--- /trunk/src/ca/sqlpower/architect/profile/ProfileManagerImpl.java Wed Jan 27 12:25:33 2010 +++ /trunk/src/ca/sqlpower/architect/profile/ProfileManagerImpl.java Thu Feb 11 11:47:13 2010
@@ -36,6 +36,8 @@
 import ca.sqlpower.architect.profile.event.ProfileChangeListener;
 import ca.sqlpower.object.AbstractSPObject;
 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;
 import ca.sqlpower.sqlobject.SQLDatabase;
 import ca.sqlpower.sqlobject.SQLObject;
 import ca.sqlpower.sqlobject.SQLObjectException;
@@ -178,7 +180,8 @@
         }
     }

-    public ProfileManagerImpl(ArchitectSession session) {
+    @Constructor
+ public ProfileManagerImpl(@ConstructorParameter(propertyName="session") ArchitectSession session) {
         this.session = session;
         if (session != null && session.getRootObject() != null) {
session.getRootObject().addSQLObjectPreEventListener(new DatabaseRemovalWatcher());
=======================================
--- /trunk/src/ca/sqlpower/architect/profile/TableProfileResult.java Wed Jan 27 12:25:33 2010 +++ /trunk/src/ca/sqlpower/architect/profile/TableProfileResult.java Thu Feb 11 11:47:13 2010
@@ -30,6 +30,8 @@
 import ca.sqlpower.architect.ddl.DDLGenerator;
 import ca.sqlpower.architect.ddl.DDLUtils;
 import ca.sqlpower.object.SPObject;
+import ca.sqlpower.object.annotation.Constructor;
+import ca.sqlpower.object.annotation.ConstructorParameter;
 import ca.sqlpower.sql.JDBCDataSource;
 import ca.sqlpower.sqlobject.SQLColumn;
 import ca.sqlpower.sqlobject.SQLObjectException;
@@ -69,7 +71,9 @@
      * @param manager
      * @param settings
      */
- public TableProfileResult(SQLTable profiledObject, ProfileSettings settings) {
+    @Constructor
+ public TableProfileResult(@ConstructorParameter(propertyName="profiledObject") SQLTable profiledObject, + @ConstructorParameter(propertyName="settings") ProfileSettings settings) {
         super(profiledObject);
         setSettings(settings);
     }

Reply via email to