15 Creating and Managing Resource Catalogs

Resource Catalogs define and organize the resources available for inclusion in a page, page template, or task flow. You can create them in JDeveloper so that they are deployed with the application. Resource Catalogs can also be created and edited in the runtime Resource Manager. This chapter describes the default Resource Catalog and explains how to customize this catalog and create new catalogs in JDeveloper.

For information about managing Resource Catalogs at runtime, see "Working with Resource Catalogs" in Oracle Fusion Middleware User's Guide for Oracle WebCenter Portal: Spaces.

This chapter contains the following sections:

15.1 Overview of Resource Catalog

The Resource Catalog, also known as Oracle Business Dictionary, provides a consolidated view of the contents of one or more otherwise unrelated repositories in a unified search and browse user interface. Resources originate in their source repository and are then exposed through the Resource Catalog as shown in Figure 15-1.

Figure 15-1 Resource Catalog Overview

Description of Figure 15-1 follows
Description of "Figure 15-1 Resource Catalog Overview"

When using JDeveloper, you see two types of Resource Catalogs—design time Resource Catalogs and runtime Resource Catalogs.

Design time Resource Catalogs are available in the Resource Palette and are like favorites lists for developers. The WebCenter Portal - Services Catalog is a design time catalog that is available out-of-the-box when you install the WebCenter Portal extension bundle. You can add task flows and data controls from this catalog to a Framework application. In addition to the WebCenter Portal - Services Catalog, you can define connections and create catalogs to organize resources exposed by those connections. Such resources can be re-used in any application that you are developing.

See Also:

Runtime Resource Catalogs are available for populating pages or page templates and task flows in deployed Spaces and Framework applications. In Spaces applications, the Resource Catalogs determine the resources available when populating pages and task flows in Composer. In addition to this, the Resource Catalogs in Framework applications also determine the resources available when creating page templates and other Resource Catalogs in the Resource Manager.

Default Resource Catalog Configuration

When you add a Page Customizable component to the page, a default Resource Catalog with the catalog definition file, default-catalog.xml, is configured in the application. Depending on the type of application you created, the catalog definition file is created in one of the following folders:

  • In a Framework application, the default-catalog.xml file is located in the APPLICATION_ROOT/Portal/public_html/oracle/webcenter/portalapp/catalogs directory. The Resource Catalog in this case contains the folders shown in Figure 15-2.

    Figure 15-2 Default Resource Catalog

    Default Resource Catalog
    Description of "Figure 15-2 Default Resource Catalog"

  • In a non-portal WebCenter application, the default-catalog.xml file is located in the APPLICATION_ROOT/Portal/src/portal directory. The Resource Catalog in this case contains the ADF Faces Components folder, which contains ADF Faces components that a user can add to the page.

    If you have registered a portlet producer with your application, then that producer's portlets are displayed in a Portlets folder in the Resource Catalog. If you have not registered any producer, the Portlets folder is hidden.

You can create custom catalogs or modify the default catalog and include components relevant to your business. For more information, see Section 15.2, "Creating a Custom Resource Catalog" and Section 15.2.3, "How to Manage Content in the Resource Catalog."

15.2 Creating a Custom Resource Catalog

Most businesses may require that users and groups have access to only those resources that they can add to a page. To address this need, you can configure multiple Resource Catalogs in your application. To configure multiple Resource Catalogs, you must first create custom catalogs with all the required resources.

This section describes how to create a custom Resource Catalog. It contains the following subsections:

15.2.1 How to Create a Custom Resource Catalog

The New Gallery dialog provides an option to create a Resource Catalog. Using this option, you can create a blank catalog and populate it with resources of your choice.

To create a catalog definition:

  1. Open your application in Oracle JDeveloper.

  2. Select the Portal project, and from File menu, choose New.

  3. In the New Gallery dialog, expand Web Tier, select Portal, then Application Resource Catalog, and click OK.

  4. In the File Name field in the Create Application Resource Catalog dialog, provide a name for the catalog, for example, users-catalog.xml.

  5. In the Directory field, specify the location for the new catalog definition XML file.

    Catalog definition files must be saved in the Resource Catalog root directory or a subdirectory of the root. The default root directory in a Framework application is APPLICATION_ROOT/Portal/public_html/oracle/webcenter/portalapp/catalogs, and in a non-Framework application is APPLICATION_ROOT/Portal/src/portal.

    Note:

    In a Framework application, to expose the new catalog in the runtime Resource Manager, you must create the catalog in the APPLICATION_ROOT/Portal/public_html/oracle/webcenter/portalapp directory.

    For example, if the Resource Catalog root is:

    C:\JDeveloper\mywork\RCSampleApp\Portal\public_html\oracle\webcenter\portalapp\catalogs
    

    You could create your catalog here or create a subdirectory for it. For example:

    C:\JDeveloper\mywork\RCSampleApp\Portal\public_html\oracle\webcenter\portalapp\catalogs\mycatalogs
    
  6. Select the Create as Portal Resource option to expose the catalog in the Resource Manager.

    Note:

    This option is displayed in a Framework application if you specified the directory to be APPLICATION_ROOT/Portal/public_html/oracle/webcenter/portalapp or a subdirectory of portalapp.

  7. Click OK.

    The new catalog definition file opens in the Overview Editor.

  8. In the right half of the Overview Editor, define catalog properties as follows:

    • In the Catalog Filter field, specify the name of the filter you want to apply to the catalog. This field is optional. For more information, see Section 15.4, "Filtering Items in the Resource Catalog."

    • In the Visible field, specify whether the Resource Catalog must be displayed. This attribute takes an EL value. The default value is #{true}, which means that the catalog is displayed to all users at all times.

    • Use the Catalog Attributes section to define the following attributes on the catalog.

      • Title: A display name for the catalog.

      • Description: A short description of the catalog. This text appears below the catalog name in the Resource Manager.

      • Subject: Keywords to facilitate keyword searching of the Resource Catalog.

      • IconURI: Specify the URI for an icon to display alongside the catalog name in the Resource Manager.

      • Tool Tip: Use to specify the tool tip to be displayed when you move the mouse over this catalog name.

      Note:

      Catalog attributes are defined within the <schema> element in the catalog definition XML file. In addition to the out-of-the-box attributes, you can expose custom attributes on the catalog by defining them within the <schema> element.

  9. Save the catalog definition file.

You can now populate your catalog with resources. See Section 15.2.3, "How to Manage Content in the Resource Catalog" for details about adding different types of resources.

Tip:

If you do not want to add resources from scratch, as a starting point, you could copy the contents of default-catalog.xml into your new catalog definition.

15.2.2 How to Define Connections to Resources

Many resources, such as WebCenter Portal services and portlets, are accessed through connections defined in your application's connections.xml file. Therefore, you must create connections before adding such resources to the Resource Catalog.

You can create connections to resources in different ways. This section describes how to create a connection from the Resource Palette. For information about additional ways to create connections, see Section 7.2, "Preparing Your Framework Application to Consume Services" and Chapter 62, "Consuming Portlets."

To create a connection from the Resource Palette:

  1. From the Resource Palette, click the New icon in the upper left corner.

  2. Choose New Connection and then the type of connection you want to create.

    The wizard for your connection type appears.

  3. Step through the wizard filling in the necessary information about the connection.

    When you click Finish, the connection should appear in the Resource Palette under Connections.

  4. Right click your connection in the Resource Palette and choose Add to Application from the context menu.

    Alternatively, you can drag and drop the connection from the Resource Palette to the Application Resources panel of the Application Navigator.

15.2.3 How to Manage Content in the Resource Catalog

You can add or remove catalog resources as required by your business.

Tip:

If you are creating a Resource Catalog from scratch, you can refer to the default catalog definition file to get an idea of how resources are included in the catalog.

Typically, catalog definition files are available in the APPLICATION_ROOT/Portal/public_html/oracle/webcenter/portalapp/catalogs directory. The Design view of a catalog definition file, shown in Figure 15-3, provides options to add, modify, and delete catalog content.

Figure 15-3 Catalog Definition File Design View

Catalog Definition File Design View
Description of "Figure 15-3 Catalog Definition File Design View"

You can add resources to a catalog in two ways:

  • Use the options on the Add menu in the Resource Catalog Overview Editor.

  • Drag and drop resources from different areas in the IDE onto the catalog definition file.

The left half of the XML editor contains the Catalog section, which displays the hierarchical structure of components in the catalog. The right half of the page provides fields to define attributes and parameters on a selected resource.

Note:

If you are using a standalone version of Composer (that is, Composer without WebCenter Portal: Framework), you can add a resource to the catalog by directly adding a <resource> element to the source of the catalog definition file. For more information, see Section C.3.12, "resource."

See Also:

For details about the catalog definition file and its attributes:

This section explains how to manage catalog resources. It contains the following sections:

15.2.3.1 Adding a Folder

You can create folders to group similar resources, thereby organizing the catalog better.

To add a folder:

  1. Open the catalog definition file in JDeveloper.

    This file is typically available in the APPLICATION_ROOT/Portal/public_html/oracle/webcenter/portalapp/catalogs directory.

  2. From the Add menu in the Catalog section, select Folder.

    A folder element is added to the catalog. The right side of the page displays fields to define the new folder's attributes and parameters.

  3. The Id field is populated with the value folder by default. You can specify a different value, but the ID must be unique within the catalog definition file.

  4. In the Visible field, you can specify an EL value to conditionally display this folder to specific users or groups. This attribute takes an EL value. The default value is #{true}, which means that the resource is displayed in the catalog at all times.

  5. Optionally, in the Folder Attributes section, you can define the following attributes by choosing them from the Add menu, shown in Figure 15-4:

    Figure 15-4 Folder Attributes

    Folder Attributes
    • Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.

    • Description: A description of this resource.

    • Subject: Keywords to facilitate keyword searching of the Resource Catalog.

    • ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.

    • IconURI: The icon to be displayed next to the resource name in the catalog.

    Selecting an option on the Add menu creates a new row in the Folder Attributes table. You can use this row to specify the name, type, and value for the new attribute.

15.2.3.2 Adding a Link

You can add the following types of links to a catalog:

  • Task Flow: Link to a WebCenter Portal service task flow (in the Resource Palette) or a custom task flow created in Oracle JDeveloper (in the Application Navigator).

  • Portlet: Link to any registered portlet producer. See Chapter 62, "Consuming Portlets" for detailed information about registering portlet producers and adding portlets to the page.

  • Content: Link to a file or directory from an existing Content Repository connection.

  • Other: Link to a custom component that you create by providing the XML code for that component.

To add a link:

  1. From the Add menu in the Catalog section, select Link.

    A url element is added to the catalog. The right side of the page displays fields to define the new link's attributes and parameters.

  2. The Id field is populated with the value url by default. You can specify a different value, but the ID must be unique within the catalog definition file.

  3. From the Type list, shown in Figure 15-5, select the type of resource that you want to create. You can choose from Taskflow, Portlet, Content, and Other.

    Figure 15-5 Types of Links

    Link Types

    Notes:

    • You can also add task flows and portlets to the catalog by dragging and dropping them from the Resource Palette or Application Resources pane onto the Catalog section in the Design view of the catalog definition file. The associated attributes are populated automatically when the resource is added to the catalog. See Section 15.2.3.7, "Dragging and Dropping a Resource into the Catalog."

    • If you added an ADF task flow to the catalog and want to export the catalog to an already deployed application, then you must deploy the task flow as a shared library to the deployed application. For more information, see Section 12.3, "Adding Custom Task Flows to Your Portal."

  4. If you are adding a custom resource, then specify the factory class of the component. For all other resource types, the Factory Class value is populated as soon as you select the type.

    The factory classes for the available resource types are as follows:

    • Task flow: oracle.webcenter.portalframework.sitestructure.rc.TaskFlowResourceFactory

    • Portlet: oracle.webcenter.portalframework.sitestructure.rc.PortletResourceFactory

    • Content: oracle.webcenter.content.model.rc.ContentUrlResourceFactory

    For more information, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."

  5. In the URL field, specify the URL to access the resource. Table 15-1 provides the URL format to be used for each resource type.

    Table 15-1 URL Format for the Different Resource Types

    Resource Type Location in the Application URL Format

    Task Flow from an ADF Library.

    Resource Palette

    taskflow://Path_to_Task_Flow/Task_Flow_Definition_File_Name#Task_Flow_ID
    

    Task Flow Within the Application.

    Application Navigator

    taskflow://Path_to_Task_Flow/Task_Flow_Definition_File_Name#Task_Flow_ID
    

    Portlet

    Portlet producer connection in the Application Resources pane or in the Resource Palette

    portlet://Producer_ID/Portlet_ID
    

    Content

    Content Repository connection in the Application Resources pane

    content://Content_Connection_ID/Document_ID
    

    Click the Browse icon next to the URL field to open the Choose Resource dialog, which enables you to add a resource of the selected type from the application or the Resource Palette.

    Note:

    If you entered the URL for a portlet or content type resource manually, and if the connection for that resource is available only in the Resource Palette, then ensure that you first add the connection to the application.

  6. In the Visible field, you can specify a true or false value, or an EL value to conditionally display this link to specific users or groups. The default value is #{true}, which means that the resource is displayed in the catalog at all times.

  7. Optionally, in the URL Attributes section, you can define the following attributes by choosing them from the Add menu:

    • Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.

    • Description: A description of this resource.

    • Subject: Keywords to facilitate keyword searching of the Resource Catalog.

    • ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.

    • IconURI: The icon to be displayed next to the resource name in the catalog.

    Selecting an option on the Add menu creates a new row in the Folder Attributes table. You can use this row to specify the name, type, and value for the new attribute.

  8. Use the URL Parameters section to define parameters on the resource. You can bind these parameters to other artifacts in the application. Click the Add icon to create a new row in the Parameters table.

15.2.3.3 Adding a Resource Catalog

You can include another Resource Catalog inside the selected catalog. When you add another catalog, only a pointer to this catalog is included in the catalog definition file. The actual catalog contents are inserted only at runtime.

To add a Resource Catalog:

  1. From the Add menu in the Catalog section, select Catalog Reference.

    A new node titled catalog is added to the catalog. The right side of the page displays fields to define the new folder's attributes and parameters.

  2. The Id field is populated with the value catalog by default. You can specify a different value, but the ID must be unique within the catalog definition file.

  3. In the Path field, specify the MDS path to the catalog definition file, for example, \oracle\webcenter\portalapp\catalogs\custom-catalog.xml.

    You can use the Browse icon to browse application folders and select the catalog definition file.

  4. In the Visible field, you can specify an EL value to conditionally display this catalog to specific users or groups. This attribute takes an EL value. The default value is #{true}, which means that this resource is displayed in the catalog at all times.

  5. Optionally, in the Catalog Attributes section, you can define the following attributes by choosing them from the Add menu:

    • Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.

    • Description: A description of this resource.

    • Subject: Keywords to facilitate keyword searching of the Resource Catalog.

    • ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.

    • IconURI: The icon to be displayed next to the resource name in the catalog.

    Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.

15.2.3.4 Adding a Component

You can add a custom component to the catalog. You can add a variety of components, such as simple ADF Faces components, compound objects containing two or more components, and JSF Verbatim tags that let you add arbitrary HTML content inside them. An example for arbitrary HTML that you can add to your catalog is a YouTube video.

To add a custom component:

  1. From the Add menu in the Catalog section, select Component.

    A component element is added to the catalog. The right side of the page displays fields to define the component's attributes and parameters.

  2. The Id field is populated with the value component by default. You can specify a different value, but the ID must be unique within the catalog definition file.

  3. In the Component Factory field, specify the name of a Java class that implements the oracle.adf.rc.component.ComponentFactory interface and creates an instance of the component based on a set of parameters, for example, oracle.adf.rc.component.XmlComponentFactory.

    As you type the name, the field auto-completes with valid factory classes from the classpath. You can also use the Browse icon to select a class.

    For more information, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."

  4. In the Visible field, you can specify an EL value to conditionally display this component to specific users or groups. This attribute takes an EL value. The default value is #{true}, which means that this resource is displayed in the catalog at all times.

  5. Optionally, in the Component Attributes section, you can define the following attributes by choosing them from the Add menu:

    • Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.

    • Description: A description of this resource.

    • Subject: Keywords to facilitate keyword searching of the Resource Catalog.

    • ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.

    • IconURI: The icon to be displayed next to the resource name in the catalog.

    Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.

  6. Use the Component Parameters section to add parameters that were defined when implementing the factory class.

    For example, if you are adding an XML component, click the Add icon in the Parameters section and select xml. In the new row that is displayed, specify the XML code for the component in the value field.

    Note:

    The xml option is displayed only if you selected oracle.adf.rc.component.XmlComponentFactory as the component factory.

    To ensure that the component works properly, you must specify the custom component ID to be #, and provide the namespace, as shown in the following example:

    <cust:panelCustomizable id="#" xmlns:cust="http://xmlns.oracle.com/adf/faces/customizable"/>
    

    The # value ensures that a unique ID is generated dynamically for the component.

15.2.3.5 Adding a Custom Folder

You can add a folder using a Resource Catalog adapter so that the folder is populated dynamically. A custom folder is not added as a folder with resources to the catalog; it contains only a reference to the factory class, which displays the resources dynamically.

To add a custom folder:

  1. From the Add menu in the Catalog section, select Custom Folder.

    A customFolder element is added to the catalog. The right side of the page displays fields to define the folder's attributes and parameters.

  2. The Id field is populated with the value customFolder by default. You can specify a different value, but the ID must be unique within the catalog definition file.

  3. In the Initial Context Factory field, specify the name of a Java class that implements the javax.naming.InitialContextFactory interface and generates the folder based on a set of parameters.

    For more information, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."

  4. In the Visible field, you can specify an EL value to conditionally display this folder to specific users or groups. This attribute takes an EL value. The default value is #{true}, which means that this resource is displayed in the catalog at all times.

  5. Select Insert Folder Contents to display the contents of the custom folder directly in the catalog rather than displaying them under the folder.

  6. Optionally, in the Custom Folder Attributes section, you can define the following attributes by choosing them from the Add menu:

    • Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.

    • Description: A description of this resource.

    • Subject: Keywords to facilitate keyword searching of the Resource Catalog.

    • ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.

    • IconURI: The icon to be displayed next to the resource name in the catalog.

    Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.

  7. Use the Custom Folder Parameters section to add parameters that were defined while implementing the factory class. You can bind these parameters to other artifacts in the application. Click the Add icon in the Parameters section to create a new row in the Parameters table.

    You may see a dropdown menu on the Add icon if the factory class exposes parameters, for example, Content Presenter-specific factory classes provide a templateView parameter.

15.2.3.6 Adding a Custom Content Provider

A custom content provider dynamically generates zero or more catalog entries at runtime. Catalog entries include folders, links, custom folders, components, and so on. When you add a Custom Folder, a folder is created in the catalog and is displayed at runtime even if it is empty. However, when you add a Custom Content element, a folder is created in the catalog, but is displayed at runtime only if it has components inside it. Except for this difference, a custom content provider is similar to a custom folder.

To add a custom content provider:

  1. From the Add menu in the Catalog section, select Custom Content.

    A customContent element is added to the catalog. The right side of the page displays fields to define the folder's attributes and parameters.

  2. The Id field is populated with the value customFolder by default. You can specify a different value, but the ID must be unique within the catalog definition file.

  3. In the Content Provider field, specify the fully qualified name of a class that implements the interface oracle.adf.rc.spi.plugin.catalog.CustomContentProviderV2.

    You can use the Browse icon to see a list of classes that implement this interface. Also, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."

  4. In the Visible field, you can specify an EL value to conditionally display this folder to specific users or groups. This attribute takes an EL value. The default value is #{true}, which means that this resource is displayed in the catalog at all times.

  5. Optionally, in the Component Attributes section, you can define the following attributes by choosing them from the Add menu:

    • Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.

    • Description: A description of this resource.

    • Subject: Keywords to facilitate keyword searching of the Resource Catalog.

    • ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.

    • IconURI: The icon to be displayed next to the resource name in the catalog.

    Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.

  6. Use the Custom Content Parameters section to define parameters on the folder. The parameters you define here are passed to and interpreted by the CustomContentProviderV2 implementation. Click the Add icon in the Parameters section to create a new row in the Parameters table.

15.2.3.7 Dragging and Dropping a Resource into the Catalog

In addition to the resources mentioned in the previous sections, you can add the following resources by dragging them and dropping them onto a selected folder in the catalog definition file:

  • Portlets, from the Application Resources pane or the Resource Palette.

  • Content from the Oracle WebCenter Portal's Content Service for Oracle WebCenter Content, from the Application Resources pane or the Resource Palette.

  • Task flows, from the Application Resources pane or the Resource Palette.

    Note:

    If you add an ADF task flow to the catalog and want to export the catalog to an already deployed application, then you must deploy the task flow as a shared library to the deployed application.

    For more information, see Section 12.3, "Adding Custom Task Flows to Your Portal."

  • Another catalog definition file, from the Application Navigator.

15.2.3.8 Editing a Resource

To edit a resource, select it in the Catalog section of the catalog definition file. The resource's attributes and parameters are displayed in the right half of the page. You can edit values for these attributes and parameters and save the catalog definition file. For details about a resource's attributes and parameters, see the section about adding that resource to the catalog.

15.2.3.9 Deleting a Resource

To delete a resource, select it in the Catalog section of the catalog definition file and click the Remove selected node icon, shown in Figure 15-6.

Figure 15-6 Delete Option in the Resource Catalog

Delete Option in the Resource Catalog

15.2.3.10 Rearranging Resources in the Catalog

While organizing resources in the catalog, you can move a resource to a different folder in the hierarchy. You can rearrange resources in the following ways:

  • Drag and drop them from one folder into another.

  • Use the Change Parent context menu option to move a resource to a different folder.

To rearrange a resource using the Change Parent option:

  1. Right-click the resource in the Catalog section of the catalog definition file and select Change Parent from the context menu.

  2. In the Change Parent dialog, shown in Figure 15-7, select the folder in which to include the resource.

    Figure 15-7 Change Parent Dialog

    Change Parent Dialog
  3. Click OK.

    Note:

    The OK button is enabled only when you select a valid location for the resource.

15.2.4 How to Expose Data Controls Created at Design Time

Oracle WebCenter Portal: Framework exposes a large number of service data controls that can be added to application pages and task flows. In addition, you may have created SQL or Web Services data controls in JDeveloper. To enable users to add these data controls to pages and task flows, you must expose the data controls in the Resource Catalog. For this, you must add a customFolder entry in your catalog definition file, as shown in the following example and Figure 15-8:

<customFolder id="dtDataControls"
               factoryClass="oracle.webcenter.datacomposer.internal.adapter.datacontrol.DTDataControlContextFactory">
  <attributes>
    <attribute value="Design Time Data Controls" attributeId="Title"/>
    <attribute value="Data controls created at design time" attributeId="Description"/>
    <attribute value="design time data controls,DT, data controls" attributeId="Subject"/>
    <attribute value="/adf/webcenter/folderlists_qualifier.png" attributeId="IconURI"/>
  </attributes>
</customFolder>

Figure 15-8 Design Time Data Controls Folder in the Catalog Definition File Overview

Catalog showing the Design Time Data Controls folder

To expose the customFolder as a translatable resource in the catalog, the folder's string attributes must be stored as resource strings in a resource bundle. For this, the catalog definition file must have a resourceBundle attribute and each translatable attribute must have an isKey attribute. Then the attribute value is saved in a resource bundle, as shown in the following example:

The resourceBundle attribute on the catalog definition:

<catalogDefinition id="DefaultCatalog" visible="#{true}"
                    resourceBundle="oracle.webcenter.portalapp.catalogs.DefaultCatalogBundle"
                   definitionFilter="portal.catalog.DefaultCatalogFilter"
                   xmlns="http://xmlns.oracle.com/adf/rcs/catalog">

The isKey attribute defined on the attributes of a translatable resource:

<customFolder id="dtDataControls"
               factoryClass="oracle.webcenter.datacomposer.internal.adapter.datacontrol.DTDataControlContextFactory">
  <attributes>
    <attribute value="DATACONTROL_FOLDER.TITLE" isKey="true" attributeId="Title"/>
    <attribute value="DATACONTROL_FOLDER.DESCRIPTION" attributeId="Description" isKey="true"/>
    <attribute value="DATACONTROL_FOLDER.KEYWORDS" attributeId="Subject" isKey="true"/>
    <attribute value="/adf/webcenter/folderlists_qualifier.png" isKey="false" attributeId="IconURI"/>
  </attributes>
</customFolder>

For more information about using resource bundles, see Section 21.12, "Configuring Runtime Resource String Editing."

At runtime, the catalog displays a folder titled Design Time Data Controls irrespective of whether the application has any design-time data controls.

In a deployed application, the Resource Manager allows you to add design-time data controls individually to custom catalogs. Out-of-the-box catalogs cannot be edited at runtime. For more information, see "Adding Resources" in Oracle Fusion Middleware User's Guide for Oracle WebCenter Portal: Spaces.

Exposing Custom Data Controls in an Already Deployed Application

If you created SQL or Web Services data controls in your application, and want to expose them in an already deployed application, you must perform the following steps:

When you perform this configuration, the deployed data controls are available in the Design Time Data Controls folder in the runtime Resource Registry. Users can add the data controls from the registry to any custom Resource Catalog, from where they can be consumed in pages and task flows.

15.2.5 How to Expose Data Controls Created at Runtime

Users can create data controls at runtime in the Resource Manager. If you want your Resource Catalog to dynamically display data controls created at runtime, add a customFolder entry in your catalog definition file, as shown in the following example:

<customFolder id="rtDataControls"
               factoryClass="oracle.webcenter.datacomposer.internal.adapter.datacontrol.DataControlContextFactory">
  <attributes>
    <attribute value="Runtime Data Controls" attributeId="Title"/>
    <attribute value="Data controls created at runtime" attributeId="Description"/>
    <attribute value="runtime data controls,RT,data controls" attributeId="Subject"/>
    <attribute value="/adf/webcenter/folderlists_qualifier.png" attributeId="IconURI"/>
  </attributes>
</customFolder>

To expose this folder as a translatable resource, the folder's string attributes must be stored as resource strings in a resource bundle. See Section 15.2.4, "How to Expose Data Controls Created at Design Time" for an example of how to create translatable resources.

At runtime, the catalog displays a folder titled Runtime Data Controls irrespective of whether the folder has any data controls.

15.2.6 How to Control Visibility of Portlets in the Resource Catalog

Out-of-the-box, a Resource Catalog displays portlets from all the available producers irrespective of whether the portlets are secured or not. As a result, users are allowed to consume even secured portlets to which they do not have access. When a user adds such a portlet to a page, the portlet component is added, but it does not display any content. To ensure that users view and consume only those portlets that they can access, you can control the visibility of portlets in the Resource Catalog. Implement the PortletItemSecurityHelper interface to display portlets conditionally in the Resource Catalog, based on the user's permissions.

To control portlet visibility:

  1. Implement the PortletItemSecurityHelper interface in your own item security helper class, for example, CustomPortletSecurityHelper.java.

    Example 15-1 shows a sample implementation of the PortletItemSecurityHelper interface. The following assumptions are made for the purpose of this example:

    • Grants are defined for each portlet to control who can see it.

    • A permission class, PortletVisibilityPermission, is defined to check a user's permissions on the portlet.

    Example 15-1 Sample Implementation of PortletItemSecurityHelper

    public class CustomPortletSecurityHelper extends PortletItemSecurityHelper
    {
        public boolean canView(String producerId, String portletId)
        {
            String permissionPath = producerId + '/' + portletId;
            PortletVisibilityPermission permission = new PortletVisibilityPermission (permissionPath, VIEW_ACTION);
            try
            {
              // throws AccessControlException if the permission is not granted
              JpsAuth.checkPermission(permission);
              canView = true;
              sLogger.logp(Level.FINE, SOURCE_CLASS, method,
                           "PortletVisibilityPermission check passed. Producer={0}, Portlet={1} Action=view",
                           new Object[]{producerId, portletId});
            }
            catch(AccessControlException ace)
            {
              canView = false;
              sLogger.logp(Level.FINE, SOURCE_CLASS, method,
                           "PortletVisibilityPermission check passed. Producer={0}, Portlet={1} Action=view",
                           new Object[]{producerId, portletId});
            }
            return canView;
        }
    }
    
  2. Create an rc_ext.xml file in the application's META-INF directory, and add the following code to register the implementation with the Resource Catalog:

    <extension xmlns:="http://xmlns.oracle.com/adf/rc/extension"
               id="your.extension.id"
               name="Your Extension Name"
               version="11.1.1.4.0">
      <item-security-helper class="your.implementation.class.name"/>
    </extension>
    

At runtime, when a user clicks Add Content in Composer, the Resource Catalog displays only those portlets on which the user has permissions.

15.2.7 How to Configure the Default Resource Catalog for an Application or Page

You can configure the default catalog at the application and page levels in the following ways:

Registering the Catalog in the adf-config.xml File

To register a Resource Catalog in the adf-config.xml file so that it is used as the default catalog for the application:

  1. Open the application's adf-config.xml file.

  2. Change the catalog-name attribute value in the <rcv:rcv-config> element and specify the custom catalog name, as shown in the following example:

    <rcv:rcv-config>
      <rcv:default-catalog catalog-name="/oracle/webcenter/portalapp/catalogs/myCustomCatalog.xml"/>
    </rcv:rcv-config>
    

    The catalog-name attribute identifies the catalog to be used as the default one.

    The path you specify is relative to the Resource Catalog root directory, for example, if you saved your new catalog definition as C:\JDeveloper\mywork\RCSampleApp\Portal\Public_Html\oracle\webcenter\portalapp\catalogs\myCustomCatalog.xml, then the catalog-name value would be /oracle/webcenter/portalapp/catalogs/myCustomCatalog.xml. The name uses the / separator because it represents a part of an MDS path.

    Note:

    For information about the Resource Catalog-specific configurations you can make in adf-config.xml, see Section B.2.2, "adf-config.xml."

  3. Save the adf-config.xml file.

15.2.8 What You May Need to Know When Defining a Resource Catalog

To correctly implement Resource Catalogs, you must know where the application looks for the definitions and the XML schema upon which the definitions are based. See Appendix B, "Composer Component Properties and Files" for further information.

15.2.9 How to Define Task Flow Parameters and Attributes of the Enclosing Show Detail Frames for Task Flows

At runtime, when you add a task flow from the Resource Catalog to your application page in Composer, the task flow is automatically enclosed in a Show Detail Frame component. You can initialize attributes, such as the title, height, or width, associated with the enclosing Show Detail Frame by defining those attributes in the catalog definition file that contains the task flow. To differentiate the task flow's properties from the enclosing Show Detail Frame's properties, you must use attr. as a prefix for Show Detail Frame properties.

For example, if a user adds a task flow to a page with a dark background setting, the task flow continues to use the background setting of the enclosing Show Detail Frame component. This may not be the look the user wants. To enable the user to change the Show Detail Frame's background property, you must initialize and expose the background attribute in the Resource Catalog. At runtime, while editing the task flow's properties, a user can also change the Show Detail Frame's background attribute.

Similarly, you can also initialize task flow parameters. You can define such parameters in the catalog definition file using an EL expression. At runtime, while editing the task flow's properties, a user can also change values for the exposed parameters. To differentiate the task flow's properties from the initialized parameters, you must use parameter. as a prefix for such parameters.

To initialize task flow parameters and Show Detail Frame properties:

  1. Open the catalog definition file that contains the task flow.

  2. Within the task flow's <url> or <resource> element, add an <attribute> entry for each parameter and Show Detail Frame attribute you want to define.

    The attributeId for a parameter must contain the parameter name along with a prefix of parameter.; the attributeId for a Show Detail Frame attribute must contain the attribute name along with a prefix of attr. as shown in the following example:

    <url visible="#{true}" factoryClass="oracle.webcenter.portalframework.sitestructure.rc.TaskFlowResourceFactory"
         id="wallMiniView"
         url="taskflow://oracle/webcenter/peopleconnections/wall/controller/taskflows/WallViewer.xml#WallViewer">
      <attributes>
        <attribute value="WALL_MINIVIEW.TITLE" attributeId="Title" isKey="true"/>
        <attribute value="WALL_MINIVIEW.DESCRIPTION" attributeId="Description" isKey="true"/>
        <attribute value="#{securityContext.userName}" attributeId="parameter.userName"/>
        <attribute value="false" attributeId="attr.stretchContent"/>
        <attribute value="never" attributeId="attr.showResizer"/>
      </attributes>
      <contents/>
    </url>
    

    Note:

    Include the isKey attribute and set it to true only if the value is coming from a resource bundle. If not included, the isKey value defaults to false.

  3. Save the catalog definition file.

15.3 Managing a Resource Catalog and Enabling Runtime Administration

The Resource Manager in a Framework application enables users with administrative privileges to create and modify application resources at runtime. By exposing catalogs in the Resource Manager, you allow administrators to manage these catalogs at runtime. You can also export selected catalogs from JDeveloper so that administrators can modify or delete them at runtime

This section outlines the tasks you can perform in JDeveloper to enable runtime administration of your catalogs. It contains the following sections:

15.3.1 Managing Resource Manager Entries

In JDeveloper, use the Resource Manager-specific options on the context menu on a catalog definition file as follows:

15.3.2 Enabling Further Development of Deployed Resource Catalogs

Out-of-the-box Resource Catalogs cannot be modified or deleted at runtime. However, users with administrator privileges can make a copy of an out-of-the-box Resource Catalog and edit its properties or delete it.

Note:

If you create a resource catalog at runtime and do not import it back into the design time environment, your new resource catalog may be lost when the application is redeployed. For more information, see the "Preserving Resource Customizations" section in the Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter Portal.

The Edit Source option in the Resource Manager enables users to modify the content of a copied or custom Resource Catalog at runtime. However, as text editing is easier in JDeveloper than in the runtime source editor, users may choose to download a Resource Catalog, edit it in JDeveloper, and upload it back to the deployed application. At design time, this type of round-trip development includes importing the downloaded Resource Catalog, editing it in JDeveloper, and exporting it so that it can be uploaded back to the deployed application.

This section describes how to import and export Resource Catalogs in JDeveloper. For information about modifying catalog content, see Section 15.2.3, "How to Manage Content in the Resource Catalog."

15.3.2.1 Exporting a Resource Catalog

To expose a Resource Catalog in an already deployed application, you must export it from JDeveloper, then upload to the application using the runtime Resource Manager. When you export a catalog in JDeveloper, an EAR file is created with the catalog definition file and the generic-site-resources.xml file. The generic-site-resources.xml file contains metadata that helps identify the type of resource, a Resource Catalog in this case, so that the resource is displayed under the correct category in the Resource Manager.

For generic information, see Section 16.4.3, "How to Export a Portal Resource from JDeveloper."

15.3.2.2 Importing a Resource Catalog

When you expose a Resource Catalog at runtime, users with privileges can add or delete components to suit their business requirements. However, to perform more complex tasks, such as applying catalog filters or adding custom resources that are not available in the deployed application, the runtime catalog must be downloaded, imported into JDeveloper and edited, exported from JDeveloper, and uploaded back to the runtime application.

Note:

To expose custom resources, such as task flows created in JDeveloper, that are not available in the deployed application, along with exporting the catalog you must also deploy the resource as a shared library.

When a user downloads a catalog from a deployed application, an EAR file is created containing the catalog definition XML file and the generic-site-resources.xml file. The generic-site-resources.xml file contains metadata specific to the Resource Catalog. This helps in identifying the type of resource, a Resource Catalog in this case. To edit the Resource Catalog in JDeveloper, you must first import the EAR file. On importing, the catalog definition file is extracted to the siteResources folder.

If the resource was downloaded from WebCenter Portal: Spaces, it is extracted to APPLICATION_ROOT/oracle/webcenter/siteresources/scopedMD/guid, where guid is the GUID of the space from which the resource was downloaded. Otherwise, the imported resource is created in APPLICATION_ROOT/oracle/webcenter/portalapp. You can open the catalog definition file and edit it as you would any other catalog at design time. The updated catalog must then be exported to the runtime application.

For generic information, see Section 16.4.2, "How to Import a Portal Resource into JDeveloper."

For information about downloading a catalog from the deployed application, see "Uploading and Downloading a Resource Catalog" in Oracle Fusion Middleware User's Guide for Oracle WebCenter Portal: Spaces.

15.3.3 Working with Spaces Resource Catalogs

Out-of-the-box, WebCenter Portal: Spaces provides several default Resource Catalogs for people to use. If these default catalogs are not suitable, you can build catalogs of your own within WebCenter Portal: Spaces. For details, see the chapter "Working with the Resources that Compose a Portal or Community" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter Portal: Spaces.If you want to create a Resource Catalog that is beyond the editing capabilities of WebCenter Portal: Spaces, you can create the catalog in JDeveloper and then upload it to WebCenter Portal: Spaces. You do not have to develop the catalog from scratch, you can export an existing catalog from WebCenter Portal: Spaces and edit it in JDeveloper, or use one of the out-of-the-box catalogs as your starting point.

Oracle WebCenter Portal provides a special JDeveloper workspace (DesignWebCenterSpaces.jws) to help you develop and upload resources, such as Resource Catalogs, to WebCenter Portal: Spaces. Chapter 55, "Extending the Spaces Application Using JDeveloper" tells you where to find the sample workspace and explains how to use the WebCenterSpacesResources project to build custom catalogs and other types of resources for WebCenter Portal: Spaces. For details, see Section 55, "Extending the Spaces Application Using JDeveloper."

15.4 Filtering Items in the Resource Catalog

If you want to arrange catalog content so that it is essentially the same for all users, but displays different subsets of the content to different users, then you can configure your Resource Catalog to filter out selected items based on specific criteria.

For example, if two users A and B have different privileges on a page, you can configure your application to display the entire catalog to user A and only a subset of items in the catalog to user B.

You can filter resources in the catalog either at the catalog level or at the individual resource level. This section explains both procedures. It contains the following sections:

15.4.1 Resource-Level Filtering

You can display a resource conditionally by specifying an EL value for the Visible attribute on the resource. For information about editing the Visible attribute, see Section 15.2.3, "How to Manage Content in the Resource Catalog."

15.4.2 Catalog-Level Filtering

To apply a filter on the catalog, you must implement the oracle.adf.rc.spi.plugin.catalog.CatalogDefinitionFilter interface. Additionally, you must associate this filter with the Resource Catalog.

To implement the CatalogDefinitionFilter:

  1. From the File menu, choose New.

  2. In the New Gallery dialog, expand General, select Java, and then Java Class, and click OK.

  3. In the Create Java Class dialog, specify a name for the class, for example, CatalogFilter.

  4. Under the Optional Attributes section, add the oracle.adf.rc.spi.plugin.catalog.CatalogDefinitionFilter interface.

  5. Click OK.

  6. Specify the logic for filtering items.

    Note:

    When implementing the filter logic it is common to want information about the current user and current page. This information can be obtained from the FacesContext.

    Example 15-2 shows a sample CatalogDefinitionFilter implementation. It is configured to hide the Discussions folder (forumsFolder) for user jdoe from the custom catalog, users-catalog.xml, described in Section 15.2, "Creating a Custom Resource Catalog." The entire catalog, with the ADF Faces Components and Discussions folders, is shown to all other users.

    Example 15-2 Sample Showing CatalogDefinitionFilter Implementation

    package webcenter;
    
    import oracle.adf.rc.catalog.CatalogElement;
    import oracle.adf.rc.spi.plugin.catalog.CatalogDefinitionFilter;
    
    import java.util.Hashtable;
    
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    
    public class CatalogFilter implements CatalogDefinitionFilter {
    
      public boolean includeInCatalog(CatalogElement element, Hashtable env) {
    
        ExternalContext ectx =FacesContext.getCurrentInstance().getExternalContext();
    
        if ("jdoe".equals(ectx.getRemoteUser()) && "forumsFolder".equals(element.getId()))
          return false;
        else
          return true;
      }
    
    }
    
  7. Open the catalog definition file.

  8. Select the root node in the Catalog section, and set the Catalog Filter field to the name of the Java class you created, for example, webcenter.CatalogFilter.

    This adds a definitionFilter attribute in Source view of the file.

  9. Save the catalog definition file.

15.5 Configuring Multiple Resource Catalogs

You can expose different catalogs to different users based on specific criteria, such as the page being edited, the user, or the user role. This section describes how to associate multiple Resource Catalogs with your application. It contains the following subsections:

15.5.1 How to Configure Multiple Resource Catalogs

To use multiple catalogs, you must implement the ResourceCatalogSelector API to select the appropriate catalog for the user and the page being edited. You must include the catalog-selector entry in your application's adf-config.xml file to specify the name of your ResourceCatalogSelector class. If you do not specify a catalog-selector, the default catalog is used for all editable pages and all users see the same content. If you specify a catalog-selector, the default catalog is used only when the specified selector returns null.

To implement multiple Resource Catalogs:

  1. Create your custom catalogs by performing the steps outlined in Section 15.2, "Creating a Custom Resource Catalog."

  2. Implement the oracle.adf.rc.model.config.ResourceCatalogSelector interface in your own Resource Catalog selector class, for example, CatalogSelector.java.

    Example 15-3 shows a catalog selector implementation where a custom Resource Catalog, admin-catalog.xml, is shown to ahunold who has administrator privileges, and users-catalog.xml is shown to users sking and jdoe. If there is a problem with rendering either of these catalogs, then the default catalog is shown to users.

    Example 15-3 Sample ResourceCatalogSelector Showing Entries for Multiple Resource Catalogs

    package webcenter;
    
    
    import javax.faces.context.FacesContext;
    
    import java.util.Map;
    
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.FacesContext;
    import javax.faces.context.ExternalContext;
    
    import oracle.adf.rc.model.config.ResourceCatalogSelector;
    import oracle.adf.rc.model.dc.RCVContext;
    
    import oracle.adf.rc.model.config.ResourceCatalogSelector;
    
    /**
     * CatalogSelector is a sample implementation of the ResourceCatalogSelector
     * interface.
     *
     * This implementation is based on the authenticated user
     */
    public class CatalogSelector implements ResourceCatalogSelector {
      public CatalogSelector() {
      }
    
      /**
       * Returns the Id of the catalog that must be used for the current
       * user.
       *
       * @param context a Map cont
       * @return id of the catalog to be used for the current user or
       *         null if the default catalog must be used.
       */
      public String getCatalogName(Map context) {
        // if no catalog is selected, return null & ensure that the Composer uses the
        // default catalog defined in the rcv-config
        String retval = null;
    
        // get information about the current user.
        FacesContext fctx = FacesContext.getCurrentInstance();
        ExternalContext ectx = fctx.getExternalContext();
        String user = ectx.getRemoteUser();
        
        if (user == null || user.length() == 0) {
          // user name is not available so use the default catalog
          retval = null;
    
        } 
        else if (user.equals("jdoe") || user.equals("sking")  ) {
          // return users-catalog for users jdoe and sking
          retval = "users-catalog";
          
          
        } 
        else if (user.equals("ahunold")) {
          // return admin-catalog for user ahunold
          retval = "admin-catalog";
          
        } 
        
        return retval;
    
        }
    }
    
  3. In your adf-config.xml file, enter the name of the class you created for selecting a Resource Catalog with the <rcv:catalog-selector> tag as show in the following example:

    <rcv:rcv-config>
    <rcv:default-catalog catalog-name="/oracle/webcenter/portalapp/catalogs/default-catalog.xml"/>
    <rcv:catalog-selector class-name="webcenter.CatalogSelector"/>
    </rcv:rcv-config>
    

    The value for catalog-name corresponds to the default catalog definition file with the MDS path.

    Note:

    For information about the Resource Catalog-specific configurations you can make in adf-config.xml, see Section B.2.2, "adf-config.xml."

15.5.2 What Happens at Runtime

Different catalogs are displayed to users based on the criteria you specified.

Based on the ResourceCatalogSelector implementation in Example 15-3, Figure 15-9 and Figure 15-10 show the two catalogs that are shown to user sking or jdoe and to administrator ahunold respectively.

Figure 15-9 Catalog Displayed to sking and jdoe

Description of Figure 15-9 follows
Description of "Figure 15-9 Catalog Displayed to sking and jdoe"

Figure 15-10 Resource Catalog Displayed to the ahunold

Description of Figure 15-10 follows
Description of "Figure 15-10 Resource Catalog Displayed to the ahunold"

15.6 Troubleshooting Problems with the Resource Catalog

This section provides information to assist you in troubleshooting problems you may encounter while using the Resource Catalog.

For information about configuring logging, see "Configuring ADF Logging for Composer".

Problem

Resource Catalog is empty.

Solution

The default catalog is not available to MDS. Ensure that the deployment profile contains the necessary entries to copy the default catalog file. Also, ensure that in the MDS section of adf-config.xml, a namespace entry points to the default catalog file.

Problem

A project task flow does not appear in the Resource Catalog.

Solution

The task flow must be packaged as an ADF Library (JAR file) and added to the project. You must also ensure that the task flow ID is given in the following format:

taskflow://Path_to_Task_Flow/Task_Flow_Definition_File_Name#Task_Flow_ID
Ex. taskflow://oracle/webcenter/peopleconnections/wall/controller/taskflows/WallViewer.xml#WallViewer