Working with XML Catalogs

In Design Studio, you model behaviors such as business rules that satisfy the business requirements of order processing. The business rules are often contained in resource files such as XQuery files, XSLT files, custom JAR files, third-party JAR files, and XML files. There can be a large quantity of resources, and some of those resources need to reference each other. Resources in OSM can be referenced through URI locators in your data model.

Because a URI must be a physical location on a server, and because the location of the resource may change depending on the run-time system to which you deploy your cartridges, using XML Catalogs in OSM is very useful. XML Catalogs provide a redirection from a URI to another URI. At run time, when OSM processes a URI you specify as part of the OSM data model, OSM first attempts to resolve the URI against the XML Catalogs you specified. Based on the mapping defined in the XML Catalogs, OSM updates the URI to adapt to the environment by resolving the location of the URI in your data model with the new URI you mapped for it in the XML Catalogs.

When you specify URIs for resources that will be redirected to other URIs at run time by way of XML Catalogs, one strategy is to treat the URIs defined in your cartridge design as logical URIs that are replaceable tokens. Using this strategy, it is useful to have a well-defined naming convention for these URIs; for example, the URI schema would include your organization name, project name, type of cartridge, and type of data entity. For more information on packaging resources when using XML Catalogs, see OSM Developer's Guide.

You can use XML Catalogs for any of the URIs you specify in the Design Studio editors. You can specify XML Catalogs in your OSM cartridge projects as well as on the OSM server for different purposes. For detailed information on how to use XML Catalogs in OSM, see the discussion on XML Catalogs in OSM Developer's Guide.

Related Topics

Enabling and Disabling XML Catalogs for a Cartridge Project

Specifying XML Catalogs for a Cartridge Project

Enabling and Disabling XML Catalogs for a Cartridge Project

If your target run-time software version is OSM 7.0.3 or later (Target Version field is set to 7.0.3 or higher), XML Catalog support is enabled by default for all cartridge projects and it is required to be enabled. Do not disable XML Catalog support.

If your target run-time software version is OSM 7.0.2 or earlier (Target Version field is set to 7.0.1 or earlier), enable or disable XML Catalog support for a cartridge in your workspace as follows:

  1. From the Studio menu, select Show Design Perspective.

  2. In the Studio Projects view, double-click the cartridge project entity for which you want to enable or disable XML Catalog support.

    The cartridge project opens in the Project editor.

  3. Click the Cartridge Management Variables tab.

  4. In the Name column, click the XML_CATALOG_SUPPORT variable.

  5. In the Default Value column, do one of the following:

    • To enable the XML Catalog for this cartridge, enter enable.

    • To disable the XML Catalog for this cartridge, enter disable.

  6. Click Save.

Note:

If your Target Version field is set to 7.0.1 or earlier, you can also enable XML Catalog support for a cartridge by adding an empty file entitled enableXMLCatalogSupport in the root directory that contains the cartridge project cartridgeProject\xmlCatalogs\enableXMLCatalogSupport. If this file is present, and you have defined the XML_CATALOG_SUPPORT cartridge management variable, OSM uses the value you configured for the cartridge management variable to disable XML Catalog support.

For instructions on specifying XML Catalogs for a cartridge, see "Specifying XML Catalogs for a Cartridge Project".

For more information on how to use the XML Catalog in OSM, including how to specify XML Catalogs on the OSM server and how to define catalog entries, see OSM Developer's Guide.

Related Topics

Working with XML Catalogs

Specifying XML Catalogs for a Cartridge Project

Specifying XML Catalogs for a Cartridge Project

To specify XML Catalogs for a cartridge project:

Caution:

XML Catalogs are system-wide entities. An XML Catalog specified in one cartridge project is used when processing requests for orders on other cartridges. Ensure URI/URL naming conventions are established across cartridges so that OSM resolves URIs as you require for each cartridge.
  1. In the Package Explorer view in Design Studio, navigate to the cartridgeProject\xmlCatalogs\core\ directory.

  2. Copy the XML Catalog template file cartridgeProject\xmlCatalogs\core\xmlCatalogCoreTemplate.xml into the same directory.

    Tip:

    You can have multiple XML Catalog files within the xmlCatalogs\core directory if you wish to organize different sets of catalog entries by file.
  3. When prompted, rename the file to any filename you want and use the suffix .xml (for example, catalog.xml).

    Note:

    You must use the file extension .xml. OSM automatically searches for files ending in .xml within the xmlCatalogs\core directory and loads any such files as XML Catalogs.
  4. Open the file and enter the XML Catalog entries you require.

    You can use any standard XML Catalog entry, but the rewriteURI entry is the most commonly used for OSM. For information on how OSM uses the rewriteURI entry, see the discussion on rewriteURI entries in OSM Developer's Guide.

    Caution:

    It is important to ensure that resources are always uniquely identifiable to a single XML Catalog entry to guarantee that the correct resource is located. For information on how to avoid defining mappings that can be satisfied by more than one entry, see the discussion on defining rewriteURI entries in OSM Developer's Guide.
  5. Save the file.

Related Topics

Working with XML Catalogs

Enabling and Disabling XML Catalogs for a Cartridge Project