This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The Creator pack needs to drag tables from the Database Explorer to a visual editor. The data in the Transferable needs to contain the table name, the instance of DatabaseConnection the table belongs to and the instance of JDBCDriver used to make the connection.
Created attachment 30961 [details] Propsed API (changes in the db/dbapi module)
Created attachment 30962 [details] Related changes in the db module
I would like to ask for a review of the proposed API. It introduces a DatabaseMetaDataTransfer class containing a TABLE_FLAVOR field describing the data flavor for tables and a Table inner class encapsulating the table data. Dragging or copying table nodes to the clipboard creates a Transferable instance which contains the table flavor and creates an instance of Table when required. This API has only one client and only supports dragging table nodes. A proper API should support dragging all nodes corresponding to database metadata and should make use of the model for database metadata in issue 61441. Because of this the API should be friend for now and thus it should be provided by the db/dbapi module. Please especially review the table flavor MIME type and suggest a better one if necessary.
Created attachment 31013 [details] Changes in the db/dbapi module (listing the new friend modules)
This API will be used by two modules from the Creator pack. I attached a diff which lists these modules in project.xml.
I had discussion with Andrei and basically agree to the API. One explanation requested though. Why do we need the SPI org.netbeans.modules.db.explorer.DbMetaDataTransferProvider. Since I view org.netbeans.modules.db.explorer as an implementation of org.netbeans.modules.db.api, having an interface in the implementation area and its implementation (org.netbeans.modules.db.api.explorer.DatabaseMetaDataTransfer. DbMetaDataTransferProviderImpl in the API area, seems kind of odd to me. - Winston
I tested the API and it seems to work perfectly. So it is a green signal from my side. - Winston
"application/x-java-openide-dbexplorer-table" - I do not think you want to refer to "openide", if you need some prefix, use "netbeans". "Support for other database tables might" - probably you wanted to say support for other database elements, or something like that.
Created attachment 31065 [details] Changes in the db/dbapi module (fixed Javadoc and flavor MIME type)
wjprakash: o.n.m.db is not an implementation of o.n.m.dbapi. Actually dbapi depends on db. Because of this db cannot refer to the flavor defined in dbapi. Instead it defines the DbMetadataTransferProvider interface, implemented by dbapi, which provides the flavor and the transferred data. You, as the client of the metadata transfer API, do not see the DbMetadataTransferProvider interface. jtulach: I fixed the Javadoc and the flavor MIME type, thank you for the catches!
If there aren't any more comments I will commit this tomorrow. Thank you for the review.
Integrated. Checking in ide/golden/friend-packages.txt; /cvs/ide/golden/friend-packages.txt,v <-- friend-packages.txt new revision: 1.15.4.1.2.92; previous revision: 1.15.4.1.2.91 done Checking in db/dbapi/arch.xml; /cvs/db/dbapi/Attic/arch.xml,v <-- arch.xml new revision: 1.1.4.2; previous revision: 1.1.4.1 done Checking in db/dbapi/nbproject/project.properties; /cvs/db/dbapi/nbproject/Attic/project.properties,v <-- project.properties new revision: 1.1.4.3; previous revision: 1.1.4.2 done Checking in db/dbapi/nbproject/project.xml; /cvs/db/dbapi/nbproject/Attic/project.xml,v <-- project.xml new revision: 1.1.4.3; previous revision: 1.1.4.2 done Checking in db/dbapi/src/org/netbeans/modules/db/api/explorer/DatabaseMetaDataTransfer.java; /cvs/db/dbapi/src/org/netbeans/modules/db/api/explorer/Attic/DatabaseMetaDataTransfer.java,v <-- DatabaseMetaDataTransfer.java new revision: 1.1.4.1; previous revision: 1.1 done Checking in db/dbapi/src/org/netbeans/modules/dbapi/resources/layer.xml; /cvs/db/dbapi/src/org/netbeans/modules/dbapi/resources/Attic/layer.xml,v <-- layer.xml new revision: 1.1.4.3; previous revision: 1.1.4.2 done Checking in db/dbapi/test/unit/src/org/netbeans/modules/db/api/explorer/DbMetaDataTransferProviderImplTest.java; /cvs/db/dbapi/test/unit/src/org/netbeans/modules/db/api/explorer/Attic/DbMetaDataTransferProviderImplTest.java,v <-- DbMetaDataTransferProviderImplTest.java new revision: 1.1.4.1; previous revision: 1.1 done Checking in db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java; /cvs/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java,v <-- DatabaseConnection.java new revision: 1.39.2.2.2.2; previous revision: 1.39.2.2.2.1 done Checking in db/src/org/netbeans/modules/db/explorer/DbMetaDataTransferProvider.java; /cvs/db/src/org/netbeans/modules/db/explorer/Attic/DbMetaDataTransferProvider.java,v <-- DbMetaDataTransferProvider.java new revision: 1.1.4.1; previous revision: 1.1 done Checking in db/src/org/netbeans/modules/db/explorer/nodes/TableNode.java; /cvs/db/src/org/netbeans/modules/db/explorer/nodes/TableNode.java,v <-- TableNode.java new revision: 1.26.26.1; previous revision: 1.26 done Checking in db/src/org/netbeans/modules/db/resources/explorer.plist; /cvs/db/src/org/netbeans/modules/db/resources/explorer.plist,v <-- explorer.plist new revision: 1.70.56.1.2.2; previous revision: 1.70.56.1.2.1 done Checking in db/test/unit/src/org/netbeans/modules/db/explorer/nodes/TableNodeTest.java; /cvs/db/test/unit/src/org/netbeans/modules/db/explorer/nodes/Attic/TableNodeTest.java,v <-- TableNodeTest.java new revision: 1.1.4.1; previous revision: 1.1 done
This broke the commit validation: http://www.netbeans.org/download/release55/buildlogs/continuous/20060621-1603/xtest_results/index.html The cause of the fail is that a method of DatabaseMetaDataTransfer is registered in the default lookup, thus this class is loaded by ValidateLayerConsistencyTest. When the class is loaded the table data flavor is created, which attempts to load the flavor's representation class (DatabaseMetaDataTransfer$Table). This is done using the current thread's context class loader, which in the test is not set to the system class loader (as it is at runtime), thus it cannot load the class. Jardo, can ValidateLayerConsistencyTest set the context class loader to the system class loader? I tried calling: Thread.currentThread().setContextClassLoader((ClassLoader)Lookup.getDefault().lookup(ClassLoader.class)); at the beginning of testAreAttributesFine(). It helped and didn't cause any other fails.
The suggested patch to ValidateLayerConsistencyTest sounds fine to me.
Probably fine fix. btw. during re-reading the diff I found that the arch document describes some API but does not use <api group="lookup" ..../> tag. Please fix that as well.
Fixed arch.xml. Checking in arch.xml; /cvs/db/dbapi/Attic/arch.xml,v <-- arch.xml new revision: 1.1.4.4; previous revision: 1.1.4.3 done
After discussing it with Jarda I fixed VLCT by setting the context class loader in the setUp() method and resetting it to the old value in tearDown(). In release55: Checking in db/dbapi/src/org/netbeans/modules/db/api/explorer/DatabaseMetaDataTransfer.java; /cvs/db/dbapi/src/org/netbeans/modules/db/api/explorer/Attic/DatabaseMetaDataTransfer.java,v <-- DatabaseMetaDataTransfer.java new revision: 1.1.4.3; previous revision: 1.1.4.2 done Checking in core/test/unit/src/org/netbeans/core/projects/ValidateLayerConsistencyTest.java; /cvs/core/test/unit/src/org/netbeans/core/projects/ValidateLayerConsistencyTest.java,v <-- ValidateLayerConsistencyTest.java new revision: 1.17.42.2.2.1; previous revision: 1.17.42.2 done In trunk: Checking in unit/src/org/netbeans/core/projects/ValidateLayerConsistencyTest.java; /cvs/core/test/unit/src/org/netbeans/core/projects/ValidateLayerConsistencyTest.java,v <-- ValidateLayerConsistencyTest.java new revision: 1.24; previous revision: 1.23 done
Also TableNodeTest failed in the 200606220200 daily run. Caused by the temporary fix in DatabaseMetaDataTransfer which didn't initialize TABLE_FLAVOR.
Tested the API with Creator Pack intgerated with NB binary (200607100200). Everything seems to work fine.