1. To create the SharedComponents
library, start by selecting New Application… in the Application Navigator. This will start the application creation wizard.
2. In the New Gallery dialog, click on the Applications node (under the General category) and select Fusion Web Application (ADF) from the list of Items.
3. In the Name your application page, enter the Application Name, Directory and the Application Package Prefix.
4. In the Name your project page, enter the business component's Project Name and Directory. For this recipe, we have called it SharedBC
.
5. In the Configure Java settings page for the business components project, accept the defaults for Default Package, Java Source Path, and Output Directory.
6. Similarly, in the Name your project page for the ViewController project, enter the Project Name and Directory. For this recipe, we have called the project SharedViewController
. Ensuring that you enter a unique package structure for both projects is the best guarantee for avoiding naming conflicts when these projects are deployed as ADF Library JARs.
7. Accept the defaults in the Configure Java settings and click Finish to proceed with the creation of the workspace.
8. Now, in the Application Navigator, you should see the two projects comprising the SharedComponents
workspace, one for the business components and another for the ViewController.
9. You will be using this workspace to add reusable business and ViewController components. For now, we will package the workspace into an ADF library JAR, without any components in it yet. In order to do this, you will need to first setup the project dependencies. Double-click on the SharedViewController
project to bring up the Project Properties dialog and select Dependencies.
10. Click on Edit Dependencies (the small pen icon) to bring up the Edit Dependencies dialog and then click on the Build Output checkbox under the business components project.
11. Click OK to close the dialog and return to the Project Properties dialog.
12. The next step is to set up the deployment profile. While at the ViewController Project Properties dialog, click on the Deployment node.
13. Since we will not be deploying this application as a WAR, select the default WAR deployment profile generated automatically by JDeveloper and delete it.
14. Then, click New… to create a new deployment profile.
15. On the Create Deployment Profile dialog, select ADF Library JAR File for the Profile Type and enter the name of the deployment profile. For this recipe, we have called the deployment profile SharedComponents
. Click OK to proceed with its creation.
16. In the Edit ADF Library JAR Deployment Profile Properties dialog that is opened, select JAR Options and specify a location where you will be placing all the reusable JAR libraries. For this recipe, we will place all reusable libraries in a directory called ReUsableJARs
.
17. When done, completely exit from the Project Properties dialog, saving your changes by clicking OK.
18. The last step involves the creation of the ADF Library JAR. You do this by right-clicking on the ViewController
project in the Application Navigator selecting Deploy and then the name of the deployment profile name (SharedComponents in this case).
19. Select Deploy to ADF Library JAR file in the Deployment Action page and click Finish to initiate the deployment process. The deployment progress will begin. Its status is shown in the Deployment tab of the Log window.
20. To create the HRDepartments
components library, similarly create a new Fusion web application for the HRDepartment
components. Follow the previous steps to setup the project dependencies. No database connection to the HR
schema is needed at this stage.
21. Create the deployment profile and deploy the ADF Library JAR. We will not be placing any components yet in this library.
22. To create the HREmployees
components library, repeat the previous steps once more in order to create another ADF Library JAR for the HR Employee
related reusable components.
23. Now create another Fusion web application, which will be used as the main application. This application will consume any of the components that reside in the ADF Library JARs created in the previous steps.
24. This can easily be done via the Resource Palette by creating a file system connection to the directory where we saved the reusable ADF Library JARs, that is, the directory called ReUsableJARs
. If the Resource Palette is not visible, select View | Resource Palette to show it. In the Resource Palette, click on the New icon and select New Connection | File System….
25. In the Create File System Connection dialog that is displayed, enter the name of the connection and the directory where you have deployed the reusable components in the previous steps.
26. Click OK to continue. You should be able to see the new File System Connection in the Resource Palette.
27. To consume reusable components, first select the appropriate project on the Application Navigator, then right-click on the ADF Library JAR on the Resource Palette and select Add to Project….
28. On the Confirm Add ADF Library dialog, click on the Add Library button to proceed.
29. Alternatively, expand the ADF Library JAR and drag-and-drop the reusable component onto its appropriate place in the workspace.