Jump to content
  • This documentation is an older version of JasperReports Server Administration Guide. View the latest documentation.

    warning-icon-ns_28x28.png.d419a093d471a455b6b8fecc152a1c1e.png

    If you installed JasperReports Server from the binary installer, the command-line utilities were configured by the installer. If you installed the WAR file distribution, you must follow the instructions in Configuring Import-Export Utilities before you can run the utilities.

    The import and export utilities are shell scripts located in the <js-install>/buildomatic folder:

    Windows:

    <js-install>buildomaticjs-import.bat
    <js-install>buildomaticjs-export.bat

    Linux:

    <js-install>/buildomatic/js-import.sh
    <js-install>/buildomatic/js-export.sh

    The examples in this chapter use the shortened Windows commands without the optional .bat extension on the command line. If you're running JasperReports Server in Linux, be sure to add the .sh file extension.

    When using the import and export utilities, keep the following in mind:

    JasperReports Server should be stopped when using the import and export utilities. This is very important for the import utility to avoid issues with caches, configuration, and security.
    All command line options start with two dashes (--).
    You must specify either a directory or a zip file to export to or import from.
    If you're importing to a different server, configure an encryption key on both servers, as described in Setting the Import-Export Encryption Key. Then enter the keystore password when prompted by the import command.
    Make sure the output location specified for an export is writable to the user running the command.
    All URIs are repository paths originating at the root. The repository paths shown in this chapter assume you're using a commercial edition of the server. In the community edition, paths don’t include organizations, for example:

    Commercial editions:

    /organizations/organization_1/reports/interactive/CustomersReport

    Community project:

    /reports/interactive/CustomersReport

    Exporting From the Command Line

    Usage: js-export [OPTIONS]

    note-icon-ns_28x28.png.00b134b0f632a432e46a5cdad048198b.png

    We recommend you stop your server instance before running the export utility. For instructions see the JasperReports Server Installation Guide.

    Specifies repository resources such as reports, images, folders, and scheduled jobs to export to the file system. You can also export the internal definitions for scheduled jobs, users, roles,and audit data. The export output is known as a repository catalog. It's either an archive file or a set of files in a folder structure:

    Options in js-export Command

    Option

    Explanation

    --everything

    Exports everything except audit and monitoring data: all repository resources, permissions, report jobs, users, and roles. If any server settings have been modified in the UI, those are also included.

    This option is equivalent to:
    --uris --repository-permissions --report-jobs --calendars --users --roles

    --help

    Displays brief information about the available options.

    --include-access-events

    Exports events (date, time, and user name of last modification).

    --output-dir

    Path of the output catalog folder.

    --output-zip

    Path and filename of the output catalog zip file.

    --report-jobs

    Comma separated list of repository report unit and folder URIs for which report unit jobs should be exported. For a folder URI, this option exports the scheduled jobs of all reports in the folder and all subfolders.

    --calendars

    When specified, the export includes any and all calendars of all types (holiday, recurring, ...) defined in the scheduler. When calendars are present in an export catalog, they're always processed and added upon import.

    --repository-permissions

    This option exports repository permissions with each exported folder and resource.

    This option should only be used in conjunction with --uris.

    --roles

    Comma separated list of roles to export. If no roles are specified with this option, all roles are exported.

    --role-users

    Use only with --roles. This option exports all users belonging to each exported role.

    --uris

    Comma separated list of folder or resource URIs in the repository.

    --users

    Comma separated list of users to export; if no users are specified with this options, all users are exported. Exporting a user includes all user attributes and all roles assigned to each user. When specifying users, you must give their organization ID if applicable, for example:

    --users superuser, "jasperadmin|organization_1", ...

    --include-audit-events

    Includes audit data for all resources and users in the export.

    --include-monitoring-events

    Includes monitoring data for all resources and users in the export.

    warning-icon-ns_28x28.png.33125e6807a969f2b47f5de01480cac8.png

    User passwords are encrypted during the export by default, but exported catalogs may contain sensitive data. Take appropriate measures to secure the catalog file from unauthorized access.

    Examples:

    Export everything in the repository:

    js-export --everything --output-dir myExport

    Export the /reports/interactive/CustomersReport report unit to a catalog folder:

    js-export --uris /organizations/organization_1/reports/interactive/

    CustomersReport --output-dir myExport

    Export the /images and /fonts folders:

    js-export --uris /organizations/organization_1/images/organizations/organization_1/reports --output-dir myExport

    Export all resources (except users, roles, and job schedules) and their permissions to a zip catalog:

    js-export --uris / --repository-permissions --output-zip myExport.zip

    Export all resources and report jobs:

    js-export --uris / --report-jobs / --output-dir myExport

    Export the report jobs of the /reports/interactive/CustomersReport report unit:

    js-export --report-jobs /organizations/organization_1/reports

    /interactive/CustomersReport --output-dir myExport

     

    Export all roles and users:

    js-export --roles --users --output-dir myExport

    Export the ROLE_USER and ROLE_ADMINISTRATOR roles along with all users belonging to either role:

    js-export --roles ROLE_USER, ROLE_ADMINISTRATOR --role-users --output-dir myExport

    The --uris option allows you to specify one or more resource URIs. A URI can specify a resource such as a report. In this case, all associated resources (such as images, subreports, data sources, resource bundles, and class files) are exported. A URI can also specify a folder. If a folder is specified, the export operation exports all resources and folders contained in the folder. In addition, it recurses through all its subfolders.

    note-icon-ns_28x28.png.f41e364e45e9530bb45c979dcc8de37f.png

    The folder named Temp at the root and in every organization is a special folder. None of the folders or resources in a Temp folder are exported.

    Importing From the Command Line

    See Import and Export Through the Command Line for guidelines when running the command-line utilities.

    warning-icon-ns_28x28.png.255c8eb62e8ef8707a561e088090a716.png

    When using the js-import command line utility, the server must be stopped to avoid issues with caches, configuration, and security. For instructions see the JasperReports Server Installation Guide.

    Usage: js-import [OPTIONS]

    Reads a repository catalog from your file system and creates the named resource in the JasperReports Server repository. The repository catalog must be one created by the export interface or the js-export command, either as a ZIP archive file or a folder structure.

    As of JasperReports Server 5.5, all exports contain encrypted passwords and if you're importing to a different server, configure an encryption key on both servers. See Setting the Import-Export Encryption Key for details.

    Options in js-import Command

    Option

    Explanation

    --help

    Displays brief information about the available options.

    --input-dir

    Path for importing a catalog from a directory.

    --input-zip

    Path and filename for importing a catalog from a zip file.

    --update

    Resources in the catalog replace those in the repository if their URIs and types match.

    --skip-user-update

    When used with --update, users in the catalog are not imported or updated. Use this option to import catalogs without overwriting currently defined users.

    --include-access-events

    Restores access events (date, time, and username of last modification) on imported resources.

    --include-audit-events

    Professional edition only. Imports any audit data in the catalog.

    --include-monitoring-events

    Professional edition only. Imports any monitoring data in the catalog.

    --include-server-settings

    Determines whether the system configuration is updated from the catalog. There are two pre-requisites for the catalog to contain configuration settings:

    The originating server settings must be modified through the UI (Log Settings, Ad Hoc Settings, Ad Hoc Cache, and OLAP Settings). For more information, see Configuration Settings in the User Interface.
    The catalog must be exported with the “everything” option from the user interface or the command-line utility.

    Imported server settings take effect when the server is started.

    --skip-themes This flag is required when importing a catalog that includes a theme, such as when using --export-everything, from a server version 5.2 or before to version 5.5 or later. If you have a custom theme to import, you can use the Theme UI to download it from the source server and upload it to the target server. If your theme contains the file pageSpecific.css, you must remove it from the ZIP file before uploading, and then redo your changes to the file based on pageSpecific.css in the target server from 5.5 or later. For more information, see Downloading and Uploading Theme ZIP Files.

    Examples:

    Import the myExport.zip catalog archive file:

    js-import --input-zip myExport.zip

    Import the myDir catalog folder, replacing existing resources if their URIs and types match those found in the catalog:

    js-import --input-dir myDir --update

    Import the myExport.zip catalog archive file but ignore any users found in the catalog:

    js-import --input-zip myExport.zip --update --skip-user-update

    Import the myDir catalog folder with access events:

    js-import --input-dir myDir --include-access-events

    When a resource in the target repository has the same URI as on that you're importing, the default behavior is leave the existing resource unchanged (no overwriting occurs).

    To delete the existing resource and replace it with a new one (of the same type and with the same URI), use the --update option. Note that, if the resource in the export catalog is a different type than the existing resource, the server returns an error and skips the update operation.

    When you import a user whose roles exist in the repository, the user is given those roles. User properties are imported with the user.

    When you import access events, the date and time of the last modification before export is restored on import for every resource. The catalog folder has to be created with access events. If you don't import access events, or if they don’t exist in the imported files, the date and time of the import are used.

    Configuring Import-Export Utilities

    If you installed JasperReports Server from the binary installer, the import-export utilities were configured by the installer. If you installed the WAR file distribution, you must configure several files before you can use the import-export utilities.

    Another option is to use the Alternate Import-Export Scripts because they don't require any configuration, regardless of the installation method.

    1. Depending on the database you use, copy the installation configuration file:

    from: <js-install>/buildomatic/sample_conf/<database>_master.properties

    to: <js-install>/buildomatic/default_master.properties

    2. Edit the default_master.properties file to set values specific to your installation. For more information about the settings in this file, see the JasperReports Server Installation Guide.

    note-icon-ns_28x28.png.9116bd8423417acad241db03921545ab.png

    Oracle users can set the sysUsername and sysPassword to the same name as dbUsername and dbPassword in the default_master.properties. The system user name and password are not required because js-import and js-export do not make changes to the database schema.

    3. Run the following command:

    js-ant clean-config gen-config

    This command will generate the following files with the values you added to the default_master.properties file:

         <js-install>/buildomatic/build_conf/default/js.jdbc.properties
         <js-install>/buildomatic/build_conf/default/js.quartz.properties (only for DB2 and PostgreSQL)
    4. Make sure the JDBC driver for your database is located in the following folder:

    <js-install>buildomatic/conf_source/iePro/lib

    If necessary, you can find links for downloading JDBC drivers from the Jaspersoft Community website:

    http://community.jaspersoft.com/wiki/downloading-and-installing-database-drivers


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...