[RSS]

linked from VWPDataSourceIntegration

Tracked by issue 94804 and issue 93949

Review Page

Background

A visualweb project that contains database rowset bindings has an associated datasource for each rowset bundled in the project. If a project is moved to another machine or the userdir was deleted (drivers and connections are lost) then at design-time, bindings to the rowsets will fail such that when a visualweb page is opened, a Component Error window opens instead of the expected page design. Since visualweb requires live connections to the database at design-time, each project data source must have a corresponding connection. This Resolve Broken Data Sources will help the user restore the driver and or connection. Also, if a project is migrated from Java Studio Creator 2 then the project datasources are restored within the project (the driver and connection are migrated when migrating the userdir settings from Creator 2)

In Creator 2, users could create data sources using the Data Sources node in the Server Navigator. Also, there was a facility to import/export datasources used by the IDE (by saving datasources used a config file) when migrating projects, whether from release to release or machine to machine.

In VWP 5.5, the Server Navigator was removed for the sake of redundancy with the Runtime window. Runtime window is where Application Servers and Database connections are made. Also, there was a limitation in that users could not create their own datasources and import/export to a config file. Instead a new facility to resolve data sources used by projects (when the corresponding database connection was not registered in the Runtime window) was implemented. See Resolving a Data Source; also there's Help topic included with VWP 5.5.

Feature summary

This feature's purpose is to detect when database connections, needed by a visualweb database project, have not been registered in the Services pane and to badge the Data Source References node, add an action to the Data Source References node and add a dialog to help guide a user to register the database connections needed. Once the connections have been registered, the datasources can be registered in the project and server specific info added to the project (setup folder with connection pool configurations).

This feature will also be used by the User settings migration feature for 6.0

This feature is similar to the 5.5. There will be a new Services palette, but only database connections will be listed, not data sources. Data sources will have to be resolved project by project, same as 5.5. See Resolving a Data Source

Migrating a project can be defined as :

  1. opening a Creator 2 or VWP 5.5 project
  2. opening a VW 6 project on another computer which doesn't have the equivalent database driver and connections registered

This feature will do the following:

  • Listen for all projects opened in the IDE
  • For each project, check if the project contains any datasources. If the project contains a datasource, retrieve the data sources from the project and check to see if connections for each data source have been registered.
  • Check for an existing connection. If connection is missing then badge the Data Source Reference(s) node, post an Alert dialog and add a Resolve Data Source(s) action
  • If a matching connection has been registered and the project's data sources have not been updated then the project's datasources will be automatically updated and a message is printed in the Output window, "Data Sources have been resolved"
  • If connections and/or driver needed by the project have not been registered, the Project and Data Source References node will be badged and a Resolve Data Source(s) action will be added.
    • Choosing this action will open a Resolve Data Source(s) dialog that lists the missing datasources.
    • When the user selects the action on the Project node, Resolve Data Source(s) clicks to Resolve then the Add Connection dialog opens where the user can register a driver and connection for the data source
  • Once the datasources have been resolved, remove the Resolve Data Source(s) context menu and print a message to the Output window to inform the user that the Data Sources have been resolved

More info:
There will be child node under Data Source References, for each data source in the project, (see Travel child node in (figure 1) . The child data sourcenode will not have an action.

Only those data sources which don't have a corresponding Database Connection will be listed in the Resolve Data Source(s) dialog. If a child data source node has a corresponding connection then it won't be badged.

For example, if the project has another data source, named Foo and there is a database connection for Foo in the Services tab then Foo will appear as a child of the Data Source References node, but it won't have a badge (red square in top right corner of the image). Also, Foo will not be listed in the Resolve Data Source(s) dialog.

Dependencies

VWProjects (Data Source References node to be provided by the Project implementation)

Use cases

Use Case A. User has a project developed in Java Studio Creator 2 or VWP 5.5 that uses rowsets - pages with components bound to rowsets and wants to import this project in Shortfin.

Use Case B. User has developed a new Visual Web application that contains a rowsets.If another user wants to use this project or the developer has removed the userdir then the data sources will not be found

Here's the steps required for both use cases to resolve missing data connections:

  1. Open the project
  2. If the project has data sources for which there is no corresponding database connection in the Runtime window, the Data Source References node icon will be badged (visible after expanding the project node). An alert dialog opens to inform the user that the project has errors and provides instructions on how to resolve the data source problem.

(figure 1)
  1. A context menuitem is added to the Project node, Resolve Database Problem. Selecting this context menuitem will open a dialog listing the missing data sources (for which there is no corresponding Database connection)
Note: Figure 3 shows the action on the Data Source References node, instead the action will be on the Project node

(figure 2)
(figure 3)
  1. To resolve a database connection to another database server, select the datasource in the Resolve Datasource(s) dialog then click the Add Database Connection button and the Add Database Connection dialog will open.

    (figure 4)
  2. If the driver has not been added then click the dropdown and choose New Driver, otherwise choose the appropriate driver.
  3. Fill in all fields. If any field is entered incorrectly, a connection error dialog will open
  4. After clicking OK, a new JDBC Driver node is added to the Runtime|Databases|Drivers node (if it had not been previously registered)and a new connection is added to the Runtime|Databases|Connections node
  5. If the page containing the components bound to rowset(s) is open, refreshing the page will restore the connections (or clicking the Continue button in the Component Error window)
  6. For databases used besides Java DB then JDBC drivers the user is required to manually copy the drivers to the Glassfish lib directory in order to execute the application
  7. If Glassfish is the target server, then this feature will add the server specific files to the project, if needed.

As a result, the project's pages that have components that bind to rowsets will rebind successfully, automagically and the project can be deployed successfully.

Issues

Notes

If a user cleans up the App Server by deleting domain1 or removing connections then by choosing to Resolve Data Sources, the connection resources are added to the project so it can be deployed successfully.

 Parameters for connecting to the Travel database
                + User ID = travel
                + Password = travel
                + Database URL = jdbc:derby://localhost:1527/travel