44 Importing and Exporting Resources and Configurations

Service Bus provides multiple ways to import and export resources from JDeveloper or the Oracle Service Bus Console, and to export resources from a command line. You can also import and export from Fusion Middleware Control Console. This chapter describes how to import and export resources using JDeveloper and the Oracle Service Bus Console, and how to export using a command line.

This chapter includes the following sections:

For information about importing and exporting projects using Fusion Middleware Control, see "Importing and Exporting Oracle Service Bus Resources" in Administering Oracle Service Bus.

44.1 About Importing and Exporting Resources

Service Bus provides import and export features to help you move your Service Bus projects and resources between domains and between development tools. For example, when you move from development to testing, you can export projects from the development environment and import them into the testing environment. When shared resources change in a production environment, the resources can be updated for each server using the export and import features. These processes support an orderly promotion of resource configurations from staging and test environments into production environments.

You can also export and import resources to move them between JDeveloper and the Oracle Service Bus Console. For example, you create certain artifacts, such as JCA adapter files and WADL files, in JDeveloper. To use those artifacts in projects in the Oracle Service Bus Console, exporting them from JDeveloper and importing them to the console maintains any references between those artifacts.

You can use existing source code control systems in conjunction with the configuration JAR files to provide version and change management for Service Bus configurations.

44.1.1 About Exporting Resources

You can export entire Service Bus projects or just individual resources. The export process creates a configuration JAR file that you can then import into a different instance of JDeveloper, the Oracle Service Bus Console, or Fusion Middleware Control. When you export at the project level, you can select one or more projects in the current instance to export. The Export Service Bus Resources wizard displays the projects, folders, and resources in a tree view, but component selection is only at the project level. When you export at the resources level, you can expand the projects to view and select individual resources to export. To avoid validation errors, you can also choose to automatically include any dependencies on the resources you select for export.

In the Oracle Service Bus Console, you can export projects and resources whether you are working within a session or outside of a session. If you export within a session, the resources are session resources and the configuration may be incomplete or have conflicts. If you export outside of a session, the resources you can export are the activated resources.

Service Bus cannot export the users, groups, or roles that you create for the console; nor can it export credential maps or other security-provider data that you create in the WebLogic Server Administration Console. Instead, use the WebLogic Server Administration Console to export this data. See "Migrating Security Data" in Administering Security for Oracle WebLogic Server.

44.1.1.1 Data Encryption During Export

When you export Service Bus projects or resources to a configuration JAR file, you can encrypt the user name and password data in service account, service key provider, UDDI registry, JNDI provider, and SMTP server resources. When you then import this JAR file, Service Bus will not import the resources with encrypted user name and password data unless you specify the correct password. You can import all of the other non-encrypted resources in the JAR file without specifying the password.

For each service account, Service Bus exports the user name and password or the local-user to remote-user map (depending on which data was stored in the service account). For each service key provider, Service Bus exports the alias to key-pair binding from the PKI credential mapping provider; it does not export private keys, certificates, or other data from the key stores. Key store data must be exported using tools that the key store vendor provides.

44.1.2 About Importing Resources

You can import complete Service Bus projects or just specific resources contained in configuration JAR files and resource JAR files that were previously exported from another Service Bus domain. You can choose to import only a subset of the exported data. If the resource already exists in the importing system, it will be updated. Otherwise, it will be created. Resources are only scheduled for deletion when the JAR being imported is a full project JAR and there are resources located in the same project in the importing system that are not present in the imported JAR file. It will not delete resources which are located in other projects.

Service Bus gives you the option toService Bus import resources at the resource level even though they were exported at the project level. For example, even if system resources were exported in a full project JAR file, you can deselect them when importing. You cannot export users, groups, roles, or certificates when you export a configuration. Therefore, you must create these objects again when you import an exported configuration.

44.1.2.1 Improving Import Performance

When you import a Service Bus project, several validations are performed against the imported resources. Depending on the size of the configuration JAR file being imported, this can slow down the import process. By default, Service Bus processes four validation threads in parallel during import. To improve performance, you can control how many threads can be used for validation by adding the following argument to the Java options in the Service Bus server start scripts (substitute the maximum number of threads to use for no_of_threads).

-Doracle.osb.config.parallelism=no_of_threads

This sets the number of threads for the Oracle Service Bus Console and for Fusion Middleware Control. To set this value for JDeveloper, add the argument to the jdev.conf file, located in MW_HOME/jdeveloper/jdev/bin.

44.1.2.2 Importing Service Accounts or Service Key Providers

If the JAR file being imported was created by AquaLogic Service Bus 3.0 or later and contains service accounts or service key providers, you can import these resources along with the user names, passwords, local-user to remote-user mappings, and alias to key-pair bindings that they contain.

For each service key provider, Service Bus imports the alias to key-pair binding into the PKI credential mapping provider. If this data was encrypted during export, you must supply the password that was used to encrypt the data. If you do not know the password, you can import all other non-encrypted resources.

If you import a service account or service key provider and a corresponding resource of the same name already exists in your domain, the imported resource will overwrite the one already in your domain, even if the one already in your domain has been modified during the current session, unless you specify to preserve security settings during import. For more information, see Preserving Security Configuration During Import.

44.1.2.3 Preserving Operational Settings During Import

There are two types of operational values: global operational settings and operational settings for individual components. Global operational settings are imported like any other resource, though you can preserve operational settings in the importing domain and prevent them from being overwritten during import by selecting Preserve Operational Values during the import. If Preserve Operational Values is not specified, the values from the JAR file being imported are set in the domain.

44.1.2.4 Preserving Security Configuration During Import

You can export and import Service Bus resources without losing any associated security configuration data. The import and export wizards let you specify whether to preserve the existing security configuration on the importing system or to overwrite the existing configuration with that of the resources you are importing. This is only an issue when the resources being imported already exist on the importing system and are updating those existing resources.

For example, you might want to configure your credentials in a staging area, export a project that contains these credentials, and then import the project in your production environment. When you export the project, the security configuration is included in the Service Bus configuration JAR file. When you then import the project on your target system, security handling depends on whether the imported resources already exist on the target system:

  • When the resources you import are new, that is they exist in the JAR file and not the target system, the resources use the security configuration from the JAR file.

  • When the resources you import exist both on the import target server and in the JAR file, the resources use the security configuration you specify. You can preserve the existing security configuration on the target system or overwrite it with the configuration in the JAR file.

The options you select during import allow you to decide which aspects of the security configuration for the resources on the importing system are preserved during import. These options work the same way when importing JAR files created by both project-level exports and for individual resource exports. The security options during import include the following:

  • Preserve Security and Policy Configuration

  • Preserve Credentials

  • Preserve Access Control Policies

Note that when you import services configured to use WebLogic Server (WLS) policies, you will be unable to edit those policies because support for WLS policy is deprecated. You should reconfigure those services with Oracle Web Services Manager policies.

44.1.2.4.1 Preserve Security and Policy Configuration

Selecting Preserve Security and Policy Configuration preserves the following configuration parameters of the resources on the importing system. The configuration of the resources being imported is not preserved.

  • Proxy service security and policy configuration:

    • A reference to the service key provider.

    • The set of policies that are bound directly to the service through the Policies tab. If the service uses WSDL-based policies, the policies are not preserved because the WSDL document itself might be updated and the service must reflect the WSDL document.

    • The state of the Process WS-Security Header option.

    • Message-level custom authentication configuration.

  • Proxy service transport-specific security configuration:

    • For HTTP, the HTTPS flag and the authentication mode (anonymous, basic, client certificate, or custom token).

    • For JMS, the JMS and JNDI service accounts.

    • For email and FTP, the service account reference.

    • For SFTP, the authentication configuration.

  • Business service security and policy configuration:

    • WS-Policy bindings.

    • The Pass Caller's Subject setting.

    • A reference to the service account for outbound WS-Security.

  • Business service transport-specific security configuration:

    • For HTTP, the authentication mode (anonymous, basic, or client certificate) and the service account reference.

    • For JMS, references to the JMS and JNDI service accounts.

    • For FTP, EJB, Tuxedo, and DSP, the service account reference.

    • For SFTP, the authentication configuration.

44.1.2.4.2 Preserve Credentials

Selecting Preserve Credentials preserves the following credentials for the resources on the importing system. The configuration of the resources being imported is not preserved.

  • PKI credentials in service key providers.

    A PKI credential mapping provider maps service key providers to key-pairs that can be used for digital signatures and encryption and for outbound SSL authentication.

  • User name and passwords in service accounts.

  • User name and password in SMTP server, JNDI provider, and UDDI registries.

44.1.2.4.3 Preserve Access Control

Selecting Preserve Access Control Policies preserves all access control policies for the proxy services on the importing system during the import process. The access control policies of the proxy services being imported are not preserved.

44.1.2.5 Customizing Environment Values After an Import

Using the customization feature, imported resources can be tailored for the new domain before activating them. Configuration files let you globally change environment-specific attributes for resources using the import functionality along with the find and replace feature. This is not meant to replace a more careful tuning of configuration that may be required by complex deployment scenarios.

In addition to service endpoint URIs, directory names, and security configuration, your Service Bus configuration may contain other settings that must be updated to operate correctly in the new environment. Items that commonly require update include the following:

  • Service references to other Service Bus resources.

  • JMS queues and connection factories in proxy or business service URLs.

  • Routing destinations in pipelines.

  • Endpoint URIs for business and proxy services.

  • Load balancing settings for business services.

  • Directory names in the transport configuration for certain polling proxy and business services.

For information about configuration files, see "Customizing Oracle Service Bus Environments" in Administering Oracle Service Bus.

44.2 Importing and Exporting Resources in JDeveloper

Service Bus lets you import from and export to a variety of sources. You can export Service Bus resources to a configuration JAR file for later import, and you can export resources directly to a running WebLogic Server. You can import resources from a configuration JAR file that was previously exported from a Service Bus instance, from a ZIP file contains Service Bus resources, or from a URL where Service Bus resources are located. You can also access resources in a UDDI registry, which is described in Working with UDDI Registries.

Caution:

Before performing an export, be sure to save all the resources you want to export. Before performing an import, be sure to save all the files in the application to which you are importing.

44.2.1 How to Export Resources to a Configuration JAR File in Oracle JDeveloper

When you export Service Bus resources to a file from JDeveloper, Service Bus generates a JAR file that can later be imported into a different Service Bus instance. When you export complete projects, the overview file, servicebus.sboverview, is not included in the export, but it is regenerated when the project is imported again.

To export resources to a configuration JAR file in JDeveloper:

  1. With a Service Bus application open, right-click in the Application Navigator and select Export.
  2. On the Export dialog, select Service Bus Resources, and click OK.

    The Export Service Bus Resources wizard appears.

  3. On the Type page, select Configuration JAR, and click Next.

    A list of resources included in the selected source appears.

  4. In the Export Level field, select the project to export complete projects, or select resource to export individual resources.
  5. Expand the list of resources, and make sure only the ones you want to export are selected.
  6. For a resource-level export, select Include Dependencies to export any additional resources referenced by the selected resources. Clear the check box to only export the resources you select.
  7. Enter the path and file name for the configuration JAR file that will be generated.
  8. To encrypt sensitive data in the exported resources, select Protect Sensitive Data and then enter the password to unlock the file in the Passphrase and Confirm Passphrase fields.

    For more information, see Data Encryption During Export.

  9. Click Finish.

    Service Bus generates the configuration JAR file in the location you specified.

44.2.2 How to Export Resources to a Server in Oracle JDeveloper

When you export Service Bus resources directly to a server, Service Bus does not generate a configuration JAR file that you can later import. Rather it exports the resources and then imports them directly into the WebLogic server you specify.

Before exporting to a server, the server must have an application connection defined in JDeveloper. Otherwise, you will be unable to select it from the list. To create an application server connection, see How to Create an Application Server Connection.

To export resources to a server in JDeveloper:

  1. With a Service Bus application open, right-click in the Application Navigator and select Export.

  2. On the Export dialog, select Service Bus Resources, and click OK.

    The Export Service Bus Resources wizard appears.

  3. On the Type page, select Server.

  4. Click Next.

    A list of resources included in the selected source appears.

  5. In the Export Level field, select the project to export complete projects, or select resource to export individual resources.

  6. Expand the list of resources, and make sure only the ones you want to export are selected.

  7. For a resource-level export, select Include Dependencies to export any additional resources referenced by the selected resources. Clear the check box to only export the selected resources.

  8. In the Server field, select the application server connection for the server to which you want to export the resources.

    Tip:

    If the server you are connecting to is not running, click Start Server at the bottom of the window to start it.

  9. In the Session field, enter the name of the session with which you want to associate the imported resources.

  10. Click Next.

    A list of the exported resources appears.

  11. Expand the list of resources, and make sure only the ones you want to import are selected.

  12. To automatically import any dependent resources, select Include Dependencies.

  13. Select any of the environment or security settings you want to preserve from the imported resources.

    For information about these settings see Preserving Security Configuration During Import and the online help provided with JDeveloper.

  14. Do the following to configure the session:

    1. To create and activate the session in the Oracle Service Bus Console, select Activate session after publish and enter a description for the session.

    2. To discard the session if conflicts result from the import or the session is unable to be activated, select Discard session if activation fails.

  15. To specify a configuration file to use to update environmental values, click Browse next to the Deployment customization file field, and navigate to and select the file to use.

  16. Click Finish.

    The selected resources are published to the specified server.

44.2.3 How to Import Resources in JDeveloper

You can import Service Bus from a variety of sources, including a previously exported configuration JAR file, an archived ZIP file, and a URL. When you import resources from a URL, you can browse multiple sources for the resource, including the file system, MDS repository, the current application, application server, project libraries, UDDI registries, and WSIL sources. The available sources vary based on the type of resource you are importing.

If you import a new Service Bus project, Service Bus generates the project overview file and adds all derivable Service Bus resources to the diagram in the Service Bus Overview Editor. If your import updates an existing Service Bus project, the overview diagram is also updated with any new resources or updated wiring. Any system resources included in the imported file are added to the Service Bus System Resources folder in the Application Resources panel. System resources are located in the System folder in the application folder.

Caution:

When you import an archived ZIP file, the file extension for any XQuery resources in the ZIP file must be .xqy and not .xquery, which was the default extension in previous versions. The extension is updated automatically when you import a configuration JAR file.

To import resources in JDeveloper:

  1. With a Service Bus application open, right-click in the Application Navigator and select Import.
  2. On the Import dialog, select Service Bus Resources, and click OK.

    The Import Service Bus Resources wizard appears.

  3. On the Type page, select one of the following sources to import:
    • Configuration JAR

    • Resources from URL

    • Zipped Resources

  4. Click Next.

    The options that appear on the Source page vary depending on your previous selection.

  5. Do one of the following:
    • If you selected Configuration JAR, browse to and select the name of the Service Bus JAR file to import.

    • If you selected Resources from URL, select the resource type from the list of options, browse to and select the resource URL, and specify the resource name.

    • If you selected Zipped Resources, browse to and select the name of the ZIP file containing the resources to import.

  6. Click Next.

    A list of resources included in the selected source appears, along with the type of operation (create, update, or delete) to be performed on each.

  7. Expand the list of resources, and make sure only the ones you want to import are selected.

    Caution:

    Review all resources that are marked for deletion, and be sure you want to delete them. If you do not want them to be deleted, clear their check boxes.

  8. If you are importing a configuration JAR file, do any of the following:
    • To automatically import any dependent resources, select Include Dependencies.

    • If the imported source is password protected, enter the password in the Passphrase field.

    • Select any of the environment or security settings you want to preserve from the imported resources.

      For information about these settings see Preserving Security Configuration During Import and the online help provided with JDeveloper

  9. Click Finish.

    The selected resources are imported and appear in the Application Navigator.

44.3 Importing and Exporting Resources in the Oracle Service Bus Console

The Service Bus import feature lets you import from a configuration JAR file that was previously exported from a Service Bus instance, from a ZIP file containing Service Bus resources, or from a URL where Service Bus resources are located. You can also import from and publish to a UDDI registry, which is described in Working with UDDI Registries..

Caution:

Before performing an export, be sure to save all the resources you want to export. Before performing an import, be sure to save all the files in the application to which you are importing.

44.3.1 How to Export Resources to a Configuration JAR File in the Console

When you export Service Bus resources from the Oracle Service Bus Console, Service Bus generates a JAR file that can later be imported into a different Service Bus instance.

To export resources to a configuration JAR file in the console:

  1. In the Project Navigator, do any of the following:
    • To select all projects to export, click Export in the Resources toolbar or right-click All Projects and select Export.

    • To select a specific project to export, select that project and then right-click it. Select Export from the menu that appears.

    The Export Resources dialog appears with list of resources available to export.

  2. Under Export Contents, select Projects to export complete projects, or select Resources to export individual resources.
  3. Expand the list of resources, and make sure only the ones you want to export are selected.
  4. For a resource-level export, select Include Resource Dependencies to export any additional resources referenced by the selected resources. Clear the check box to only export the resources you select.
  5. To encrypt sensitive data in the exported resources, select Protect Sensitive Data and then enter the password to unlock the file in the Passphrase and Confirm Passphrase fields.

    For more information, see Data Encryption During Export.

  6. Click Export.
  7. On the File Download dialog, click Save, specify a location and filename for the configuration JAR file and click Save again.

    Service Bus generates the configuration JAR file in the location you specified.

44.3.2 How to Import Resources from a Configuration JAR File in the Console

Note:

When you import a configuration JAR file containing XQuery resources from previous versions, the file extension of the resources is automatically updated from .xquery to .xqy. The default extension in previous versions was .xquery.

To import resources from a JAR file in the console:

  1. Do one of the following:
    • In the Project Navigator, right-click All Projects, point to Import, and then select Config Jar.

    • Click the Import icon in the Resources toolbar.

  2. On the Import Config JAR wizard, browse to and select the JAR file to import.
  3. Click Next.

    A list of resources included in the selected source appears, along with the type of operation (create, update, or delete) to be performed on each.

  4. Expand the list of resources, and select the ones you want to import. By default, all resources are selected.

    Caution:

    Review all resources that are marked for deletion, and be sure you want to delete them. If you do not want them to be deleted, clear their check boxes.

  5. To automatically import any dependent resources, select Include Dependencies.
  6. If the imported source is password protected, enter the password in the Passphrase field.
  7. Select any of the advanced settings you want to preserve from the imported resources. You can preserve any of the following:
    • Security and policy values

    • Credentials

    • Access control policies

    • Environmental variable values

    • Operational settings

    For more information, see Preserving Security Configuration During Import or the online help provided with the console.

  8. Click Import.

    The selected resources appear in the Project Navigator. The Import Config JAR wizard displays a summary of the import along with any errors in the imported resources.

  9. To view any resources that were deleted during the import process, click the Deleted Resources tab.
  10. To import another JAR file, click Import Another and repeat the above steps. Otherwise, click Close.

44.3.3 How to Import Resources from a ZIP File in the Console

When you import a ZIP file, each file in the ZIP file is a possible resource and Service Bus identifies the type of resource in each file by its file extension. Each resource has a default extension in Service Bus, but if you have additional extensions to describe those resources, you can define those extension mappings when you import the ZIP file. An extension can only be associated with one file type.

During the import process, Service Bus scans the contents of the ZIP file and tries to associate a resource type with each file. A file without an extension or one that does not have an extension defined in the map is considered unknown and is automatically excluded from the load. For known files, the name of the resource is the name of the file without its extension. The folder structure of the Zip file is recreated in the target project or folder.

Resources like WSDL documents or XML Schemas can define full trees of dependent resources. The bulk load feature lets you upload a set of resources at once so you do not need to resolve the dependencies manually.

Caution:

When you import an archived ZIP file, the file extension for any XQuery resources in the ZIP file must be .xqy and not .xquery, which was the default extension in previous versions.

To import resources from a ZIP file in the console:

  1. In the Project Navigator, right-click the project or folder into which you want to import resources, point to Import, and then select Zip File.
  2. On the Import from a ZIP File wizard, browse to and select the ZIP file to import.
  3. In the Extension Mappings table, review the mapping of resource types to file extensions. Change or add file extensions, according to your needs. Separate multiple extensions with commas.
  4. Click Next.

    A list of resources included in the selected source appears, along with the type of operation (create, update, or delete) to be performed on each.

  5. Expand the list of resources, and select the ones you want to import. By default, all resources are selected.
  6. Click Import.

    The selected resources appear in the Project Navigator. The Import from a ZIP File wizard displays a summary of the import along with any errors in the imported resources.

  7. To import another ZIP file, click Import Another and repeat the above steps. Otherwise, click Close.

44.3.4 How to Import Resources from a URL in the Console

You can perform a bulk import of resources available at a URL or on the file system. Bulk import lets you import a root resource, such as a WSDL document, along with its dependents, such as other WSDL documents and schemas. The dependency map is resolved automatically.

A Warning icon next to file name indicates that the resource type is unknown. (A file without an extension or one that does not have an extension defined in the map is considered unknown.) Files of unknown file types cannot be imported.

To import resources from a URL in the console:

  1. In the Project Navigator, right-click the project or folder into which you want to import resources, point to Import, and then select From URL.
  2. On the Import from URL wizard, enter the following information:
    • Resource Type: Select the type of resource to import from the list of options.

    • URL Source: Enter the URL or local path to the resource to import. To specify a local resource, use the file protocol. For example:

      file:///c:/osbresources/ForeachAction.jar
      
    • Resource Name: Enter the name of the resource to import.

  3. Click Next.

    A list of resources identified in the URL appears.

  4. Expand the list of resources, and select the ones you want to import. By default, all resources are selected.
  5. Click Import.

    The selected resources appear in the Project Navigator. The Import from URL wizard displays a summary of the import along with any errors in the imported resources.

  6. To import more resources from a URL, click Import Another and repeat the above steps. Otherwise, click Close.

44.4 Exporting a Service Bus Configuration Offline

This section describes how to export a Service Bus configuration when you are not connected to a server. You can export complete projects or individual resources into a configuration JAR file that can then be imported into a new Service Bus environment or instance.

44.4.1 About the Export Process

You can export a Service Bus configuration in offline mode using a command line, Ant task, or the WebLogic Scripting Tool (WLST). All methods use an export settings file to define how the export is executed and which files, folders, projects, or system resources to include in the generated configuration JAR file.

The export tool runs in two phases, load and export, and each phase is configured in an export settings file. During the load phase, the export tool traverses the file system, identifies the files to read, converts the file content into the corresponding resource, and imports the file into the configuration framework.

For the load phase, you can configure the following:

  • Directory structure: There is no dependency on the JDeveloper work directory structure; you can specify project root directories, directories where system resources are located, and specific folders and files to include.

  • File extensions: In Service Bus, each resource type uses a specific file extension, such as .proxy for proxy services, .xsl and .xslt for XSLT resources, and so on. Each extension can map to only one Service Bus resource type, but a resource type can map to multiple file extensions. Each Service Bus resource has one default extension that cannot be changed, but you can also specify custom file extensions for a resource. In order for the export tool to recognize files with custom extensions, you need to define file extension mappings in the export settings file.

  • Inclusion and exclusion rules: When you specify a project or system resources folder, all Service Bus files are included in the export. You can use include and exclude statements for finer control over which files are included. For example, certain versioning systems create additional system folders and files within the project folders. These files might be recognized as Service Bus resources and included in the exported JAR file unless they are specifically excluded from the export.

The Service Bus configuration can be exported at the project level and at the resource level, and you can define multiple configuration exports in one export settings file. For the export phase, you can configure the following:

  • Project-level export: At the project level, you specify the names of the projects to include as well as whether to include system resources. If no project names are provided, all projects added during the load phase are included in the generated export file.

    Note:

    Do not export at the project level if detailed inclusions have been defined for the load phase; this could result in deleting all resources that were not included.

  • Resource-level export: At the resource level, you specify the resources to export using inclusion and exclusion rules as described above. You can also specify whether to include dependencies. If no resources are specified in the export settings file, all resources are exported.

  • Multiple configuration JAR files: You can define multiple configjar elements in the export settings file, each of which defines the export to a specific file. You can also specify whether to overwrite existing files of the same name.

44.4.2 Preparing to Export a Service Bus Configuration

Perform the following steps before you export a Service Bus configuration in offline mode:

44.4.2.1 Before You Begin

Before you begin exporting resources, verify that you have the following installed:

  • Service Bus 12.1.3

  • Java 1.7.x

When you export the configuration, note the following:

  • The resource JAR names in your scripts contain the correct version numbers.

  • You may see exception stack traces in the output or the workspace log file if JDeveloper work files are read-only.

  • An exit value of 0 means the export succeeded.

Note:

If you have developed a custom transport, you need to create an offline transport plug-in file and save it to OSB_ORACLE_HOME/config/plugins in your Service Bus installation.

44.4.2.2 Creating the Export Settings File

Rather than using command line arguments when performing an offline export, the export tool refers to a settings file that you create. This file is in XML format and contains all of the required information for the export tool to be able to find and load files and then create the configuration JAR file. For information about the file format and schema definition, as well as examples of usage, see Export Settings File Format, Samples, and Schema.

44.4.2.3 Configuring the Environment

Before performing the export, you need run the setenv.* file to set the environment variables used by the tool. You can customize this file before running it by modifying the JVM heap size, adding JAR files to the CLASSPATH, or adding system properties. If you have JAR resources that are included in the export and that require custom JAR files, make sure to add the custom JAR files to the setenv.* file.

Once you have customized the file, navigate to OSB_ORACLE_HOME/tools/configjar and run the following command:

For Windows:

setenv.bat

For UNIX or Linux:

source setenv.sh

44.4.3 Exporting a Service Bus Configuration Offline

The following sections describe scripting and command-line options for performing an offline export of a Service Bus configuration:

44.4.3.1 Exporting a Configuration Offline Using a Command Line

Exporting from the command line generates a Service Bus configuration JAR file from the folders and files you specify in the export settings file.

Syntax

Use the following syntax for Windows:

configjar.bat -settingsfile <FILE_NAME> [-debug -help]

Use the following syntax for UNIX or Linux:

./configjar.sh -settingsfile <FILE_NAME> [-debug -help]

Parameters

The following parameters can be used at the command line:

  • -settingsfile FILE_NAME: Enter the path and filename of the export settings file. This parameter is required.

  • -debug: Include this optional parameter in the command to enable debug logging of the export process. If this flag is not included, debug logging is not performed.

  • -help: Include this optional parameter in the command to view usage information.

44.4.3.2 Exporting a Configuration Offline Using Ant

You can export a Service Bus configuration in offline mode using an Apache Ant build file. Exporting using Ant generates the configuration JAR file from the folders and files you specified in the export settings file.

Sample Build File

Below is a sample Ant build file:

<project name="ConfigExport" basedir=".">
    <target name="run">
       <ant antfile="configjar-ant.xml" target="run">
          <property name="settingsFile" value="/osb/config/exportProps1.xml"/>
       </ant>
       <ant antfile="configjar-ant.xml" target="run">
          <property name="settingsFile" value="/osb/config/exportProps2.xml"/>
       </ant>
    </target>
</project>

Note:

This is only a sample script. You can use it as a basis for your own script, but be sure to check paths and file names against your current installation for accuracy.

Parameters

For Ant, the following parameters are supported:

  • settingsFile: The path and filename of the export settings file. This parameter is required

  • debug: Set this parameter to true to enable debug logging of the export process; otherwise set it to false. This parameter is optional and set to false by default.

  • failonerror: Set this parameter to true if you want the task to fail when the export tool fails. If you set it to false, the task does not fail even if the export tool fails. This parameter is optional and set to true by default.

  • errorProperty: If specified, this parameter is set to true if execution fails. This parameter is optional and is not specified by default.

44.4.3.3 Exporting a Configuration Offline Using WLST

You can export a Service Bus configuration file in offline mode using the WebLogic Scripting Tool (WLST). Exporting using WSLT generates a Service Bus configuration JAR file from the folders and files you specified in the export settings file.

Sample WLST Script

Below is a sample WLST script:

from com.bea.alsb.tools.configjar import ConfigJar

args = []
args.append('-settings')
args.append('/osb/config/exportProps2.xml')
ConfigJar.main(args)

Parameters

The following parameters can be used:

  • -settingsfile FILE_NAME: Enter the path and filename of the export settings file. If you use a relative path, the path resolves from the directory where the export tool resides (OSB_ORACLE_HOME/tools/configjar). This parameter is required.

  • -debug: Include this optional parameter in the command to enable debug logging of the export process. If this flag is not included, debug logging is not performed.

  • -help: Include this optional parameter in the command to view usage information.

44.4.4 Export Settings File Format, Samples, and Schema

By configuring the export settings, you can specify the files and folders to be included in the configuration JAR file that is exported. You can do this at the project and resource level, and you can use a series of exclusion and inclusion rules for a finer level of control. The included files and folders make up the content set for the export.

44.4.4.1 Export Settings File Format

The export settings file contains two main sections: source and configjar. The source element defines the files to be picked up by the export tool, and the configjar element defines which of the files that were picked up will be included in the generated configuration JAR file.

In the source element, you specify the project root directories for the projects to export, the location of the system resources to export, and specific files to include or exclude. You can also map custom file extensions to Service Bus resource types so the export tool can recognize them as valid Service Bus components.

Note:

If you specify relative directories for the project root or resource folders, the path is resolved relative to the directory in which the export settings file is located.

In the configjar element, you name the generated JAR file and specify rules at the project and resource level, including whether to include system resources at the project level and whether to include dependencies at the resource level. You can define multiple configjar elements; a JAR file is generated for each configjar element you define.

For guidance and restrictions on naming configuration JAR files, see Naming Guidelines for Service Bus Components.

44.4.4.2 Validation

The same naming validation rules that are applied in Service Bus are also applied to the files to be included in the content set. Any files or folders that do not conform to these rules are excluded from the content set.

  • Folders and files must have valid names.

  • File extension must map to a Service Bus resource.

    Two different files cannot map to the same instance of com.bea.wli.config.Ref (see the Java API Reference for Oracle Service Bus for more information).

44.4.4.3 Inclusion and Exclusion Rules

When you use inclusion and exclusion rules, a file must match at least one of the inclusion rules and none of the exclusion rules to be included in the content set. For a file to be excluded, it must match at least one of the exclusion rules or none of the inclusion rules. If no inclusion or exclusion rules are defined, all files are automatically included.

The inclusion and exclusion rules are based on a simple pattern.

  • The pattern is applied on the file sub-path starting with the project name. It is not applied on the full file path.

  • An asterisk (*) is a wildcard representing any character. It can be used as part of a file or directory name.

  • When a double asterisk (**) is used alone, it matches zero or more directories and files.

44.4.4.4 Export Settings File Samples

This section provides sample export settings files that show ways to export Service Bus configurations using a variety of rule combinations for the load and export phases.

Example - Exporting from a Non-JDeveloper File Structure

The following sample illustrates how to package a project and its associated system resources from a structure like Maven. This sample outputs two configuration JAR files. The first is a project-level configuration with no system resources, and the second is a resource-level configuration with JNDI and SMTP resources.

<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config">
        <source>
                        <project dir="/scratch/modulePO/src/main/resources/PO"/>
                        <system  dir="/scratch/modulePO/src/main/system"/>
        </source>
        <configjar jar="/scratch/modulePO/sbconfig-po.jar">
                        <projectLevel includeSystem="false"/>
        </configjar>
            <configjar jar="/scratch/modulePO/sbconfig-po-system.jar">
                        <resourceLevel>
                                <resources>
                                                <include name="**/*.jndi"/>
                                                <include name="**/*.smtp"/>
                                </resources>
                        </resourceLevel>
        </configjar>
</configjarSettings>

Example - Exporting at the Project Level

The following sample illustrates how to package system resources from different locations and export them by project. You can delete any unneeded resources when you import the configuration.

<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config">
        <source>
                        <system dir="/scratch/moduleX/src/main/system"/>
                        <system dir="/scratch/moduleY/src/main/system"/>
                        <system dir="/scratch/moduleZ/src/main/system"/>
        </source>
        <configjar jar="/scratch/sbconfig-systems.jar">
                        <projectLevel includeSystem="true"/>
        </configjar>
</configjarSettings>

Example - Excluding File Extensions in the Load Phase

This sample illustrates how to package all non-service resources into a configuration JAR file by defining exclusion rules in the source element. Compare this with the next example, "Excluding File Extensions in the Export Phase". Note that excluding files during the load phase is the recommended method for performance reasons.

<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config">
        <source>
                        <project dir="/scratch/jdeveloper/mywork/projectX"/>
                        <project dir="/scratch/jdeveloper/mywork/projectY"/>
                        <fileset>
                                        <exclude name="**/*.proxy"/>
                                        <exclude name="**/*.biz"/>
                                        <exclude name="**/*.flow"/>
                        </fileset>
        </source>
        <configjar jar="/scratch/jdeveloper/mywork/sbconfig-resources.jar">
                        <resourceLevel/>
        </configjar>
</configjarSettings>

Example - Excluding File Extensions in the Export Phase

The following sample illustrates how to package all non-service resources into a configuration JAR file by defining exclusion rules in the configjar element.

<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config">
        <source>
                        <project dir="/scratch/jdeveloper/mywork/projectX"/>
                        <project dir="/scratch/jdeveloper/mywork/projectY"/>
        </source>
        <configjar jar="/scratch/jdeveloper/mywork/sbconfig-resources.jar">
                        <resourceLevel>
                                <fileset>
                                                <exclude name="**/*.proxy"/>
                                                <exclude name="**/*.biz"/>
                                                <exclude name="**/*.flow"/>
                                </fileset>
                        </resourceLevel>
        </configjar>
</configjarSettings>

Example - Mapping File Extensions

The following example illustrates how to map additional file extensions to specific Service Bus resource types, in this case to XQuery and XML types.

     <configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config">
        <source>
                        <project dir="/scratch/jdeveloper/mywork/projectX"/>
                        <project dir="/scratch/jdeveloper/mywork/projectY"/>
                        <extensionMapping>
                                <mapping type="Xquery" extensions="xquery,xq,xqy"/>
                                <mapping type="XML" extensions="toplink"/>
                        </extensionMapping>
        </source>
        <configjar jar="/scratch/jdeveloper/mywork/sbconfig.jar">
                        <resourceLevel/>
        </configjar>
</configjarSettings>

Note:

When mapping file extensions, the type attribute must match a Service Bus resource type defined in com.bea.wli.config.Ref. For more information, see the Java API Reference for Oracle Service Bus.

44.4.4.5 Export Settings File Schema Definition

Below is the schema definition for the export settings XML file. Note that some of the text has been wrapped for readability.

<?xml version="1.0"?>
<xs:schema targetNamespace="http://www.bea.com/alsb/tools/configjar/config"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns:tns="http://www.bea.com/alsb/tools/configjar/config">
<xs:element name="configjarSettings" type="tns:configjarSettings"/>
<xs:complexType name="configjarSettings">
   <xs:sequence>
      <xs:element name="source" type="tns:source" />
      <xs:element name="configjar" type="tns:configjar" maxOccurs="unbounded"/>
   </xs:sequence>
</xs:complexType>
<xs:complexType name="source">
   <xs:sequence>
      <xs:choice minOccurs="1" maxOccurs="unbounded">
         <xs:element name="project">
            <xs:complexType>
               <xs:attribute name="dir" type="xs:string" use="required"/>
            </xs:complexType>
         </xs:element>
         <xs:element name="system">
            <xs:complexType>
               <xs:attribute name="dir" type="xs:string" use="required"/>
            </xs:complexType>
         </xs:element>
      </xs:choice>
      <xs:element name="extensionMapping" minOccurs="0">
         <xs:complexType>
            <xs:sequence>
               <xs:element name="mapping" minOccurs="0" maxOccurs="unbounded">
                  <xs:complexType>
                    <xs:attribute name="type" type="xs:string" use="required"/>
                    <xs:attribute name="extensions" type="xs:string"
                                  use="required"/>
                  </xs:complexType>
               </xs:element>
            </xs:sequence>
         </xs:complexType>
      </xs:element>
     <xs:element name="fileset" type="tns:contentSet" minOccurs="0"/>
  </xs:sequence>
</xs:complexType>
<xs:complexType name="configjar">
  <xs:sequence>
      <xs:choice minOccurs="1" maxOccurs="1">
         <xs:element name="projectLevel" type="tns:projectLevel"/>
         <xs:element name="resourceLevel" type="tns:resourceLevel"/>
      </xs:choice>
  </xs:sequence>
  <xs:attribute name="jar" type="xs:string" use="required"/>
  <xs:attribute name="overwrite" type="xs:boolean" use="optional" default="true"/>
</xs:complexType>
<xs:complexType name="projectLevel">
   <xs:sequence>
      <xs:element name="project" type="xs:string" minOccurs="0" 
                  maxOccurs="unbounded"/>
   </xs:sequence>
   <xs:attribute name="includeSystem" type="xs:boolean" use="optional" 
                 default="false"/>
</xs:complexType>
<xs:complexType name="resourceLevel">
   <xs:sequence>
      <xs:element name="resources" type="tns:contentSet" minOccurs="0"/>
   </xs:sequence>
   <xs:attribute name="includeDependencies" type="xs:boolean" use="optional" 
                 default="true"/>
</xs:complexType>
<xs:complexType name="contentSet">
   <xs:sequence>
      <xs:element name="include" type="tns:contentSetPattern" minOccurs="0" 
                  maxOccurs="unbounded"/>
      <xs:element name="exclude" type="tns:contentSetPattern" minOccurs="0" 
                  maxOccurs="unbounded"/>
   </xs:sequence>
</xs:complexType>
<xs:complexType name="contentSetPattern">
  <xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:schema>