There are two ways to create a service resource for use with a custom component:
Note:For more information about custom components, see the Oracle Fusion Middleware Developer's Guide for Content Server.
To create a custom service resource manually:
The HTM file must include a table that is identical in structure to the StandardServices table. See "Service Structure Overview".
Make a copy of the std_services.htm file, place it in your custom component's resources directory, and rename the file to avoid confusion. For example:
Change the name of the StandardServices table to a new name. For example:
Delete all of the rows in the table except for a service that is similar to the one you want to create.
Edit the entries in the Name, Attributes, and Actions columns.
Save and close the file.
For example, the following HTM file shows two custom services named ADD_REPORT and REPORTS_LIST:
Here is an example of a custom services HTM file, displayed in a text editor.
<HTML> <HEAD> <META HTTP-EQUIV='Content-Type' content='text/html; charset=iso-8859-1'> <TITLE>Custom Scripted Services</TITLE> </HEAD> <BODY> <@table MyServices@> <table border=1><caption><strong>Scripts For Custom Services </strong></caption> <tr> <td>Name</td><td>Attributes</td><td>Actions</td> </tr> <tr> <td>ADD_REPORT</td> <td>Service 18 ADD_REPORT_FORM null null<br> Unable to add report.</td> <td>2:Ireport::0:null</td> </tr> <tr> <td>REPORTS_LIST</td> <td>Service 17 REPORT_LIST_FORM null null<br> Unable to retrieve reports.</td> <td>5:Qreports:REPORT_LIST:0:null</td> </tr> </table> <@end@> <br><br> </BODY> </HTML>
Open the component definition (glue) file of the custom component in a text editor. For example, DomainHome/ucm/cs/custom/my_component/my_component.hda.
Add the new HTM file to the ResourceDefinition ResultSet. For example:
@ResultSet ResourceDefinition 4 type filename tables loadOrder service resources/my_services.htm MyServices 1 @end
Save the file.
To create a service resource using the Component Wizard:
In the Component Wizard, open the component the resource will be created for.
On the Resource Definition tab, click Add.
The Add Resource screen is displayed.
Select the Service option.
Enter the file name for the resource file. The default file name is resources/componentname_service.htm.
If a resource file has been created for services, you can append the new service table to the existing file by selecting the file name. Any changes you make to the load order will apply to the entire resource file.
To create a new resource file with a different file name, enter the file name. For example, my_services.htm.
If you want the new resource file to be loaded in a particular order, enter the number in the Load Order field.
Note:Unless you have a particular reason for the resource file to be loaded after other resources, you should leave the load order set to 1.
The Add Service Table Information screen is displayed.
Enter a name for the service table.
It is a good idea to leave the name of the component as a prefix. For example, My_Component_Services.
Each service table in a component must have a unique name, even if the tables are in different resource files.
The Add Service screen is displayed.
A list of commonly used services is displayed.
Select the Show All check box to show the entire list of predefined services.
Select a service from the list. To view details about a service, highlight the service name and click Preview.
Tip:To view the online help for the selected service, click the Help button on the Preview Information for Service <SERVICE_NAME> dialog.
The service attributes and actions are filled in.
Note:If you do not change the name of the service and this component is loaded last, the custom service will override the standard service and any other custom services with the same name.
Edit the service attributes as necessary.
Enter the actions as necessary.
Actions must appear in the Actions list in order of execution. Use the Up and Down buttons to move the selected action.
To add an action, click Add. Enter the action definition and click OK.
To edit an action, select the action and click Edit. Modify the action definition and click OK.
To remove an action, select the action and click Delete.
A dialog box asks if you want to launch the text editor to continue editing.
Click Yes to open the resource file in the text editor. Click No to return to the Component Wizard.
The service resource file now appears in the Custom Resource Definition list, and the service table appears in the Table Name list in the right pane.