Managed files

Any file that is uploaded to WebSphere Commerce by using the catalog and marketing attachments tools in WebSphere Commerce Accelerator or by using the fileloader utility becomes a managed file. Review the managed file lifecycle to better understand the use of managed files.

Managed file lifecycle

This lifecycle that is described here is different if you are working within a workspace. For more information, see Managed files and workspaces.

Managed files are initially written to the WebSphere Commerce database. Once certain criteria are met, managed files are copied from the WebSphere Commerce database to the WebSphere Commerce EAR file.

In a federated environment, all copies of the WebSphere Commerce EAR file are updated automatically. Updating all Commerce nodes in a federated environment is not an instantaneous process. The exact amount of time that is taken to complete the update depends on the size of the managed file and the size of WebSphere Commerce EAR file.

You cannot view the managed file as an attachment in a store page until the managed file is available in the WebSphere Commerce EAR file. While the attachment asset is only available in the WebSphere Commerce database, you can view only the file in a store page by using the preview function.

A managed file follows the following lifecycle:

  1. A user uploads the file by using the catalog and marketing attachments tools in WebSphere Commerce Accelerator or the fileloader utility and the file is stored in the WebSphere Commerce database.
  2. The EAR updater job, ScheduledContentManagedFileEARUpdateCmdImpl, is called by the scheduler every half hour.

    ScheduledContentManagedFileEARUpdateCmdImp checks for the following criteria:

    • If enough files are uploaded, the managed files are written to the WebSphere Commerce EAR file, regardless of the time that is passed since the last update. The default number of files is 10.
    • If a fixed amount of time is passed and at least one managed file is uploaded, the managed files are written to the WebSphere Commerce EAR file, regardless of the number of files that are uploaded since the last update.
    • If there are many files to update, these files are split into segments. Each segment deals with a fixed number of files. The default number of files is 100.
    • If neither criteria is met, no update occurs. The default amount of time is 60 minutes.
  3. The managed files are in the WebSphere Commerce EAR file and available for viewing from store pages. The Managed Files are stored in the databases in the tables (CMFILE, CMSMALLFILE, and CMLARGEFILE). These managed files are organized in a directory structure under the database table CMFILEDIR (which is the Managed File Directory). There is no direct database relationship between the CMFILEDIR and STORE database tables, however the top-level managed file directory within the CMFILEDIR table is typically the name of the store directory. The CMFILEDIR database tables stores the directory structure for managed files. This directory structure should be a subset of the directory structure within the WebSphere Commerce EAR. The root managed file directory in this table is "null", which is the value of the CMFILEDIR_PARENT column in the CMFILEDIR table. Within the WebSphere Commerce EAR, the root directory is the Stores.war directory.
  4. The managed files are published to the production environment by using the fileprop utility. If you want to publish files to a different directory in the production environment, create the destination directory structure within the authoring environment first. Load the files into these new directories and then use the fileprop utility to publish the files and directories to the new destination in the production environment.

Both the time and number of files criteria for the WebSphere Commerce EAR update can be changed by your Site Administrator. Contact your Site Administrator to learn the criteria values.

Managed files and workspaces

The lifecycle of a managed file in a workspaces-enabled environment, an authoring server, or a workspaces-enabled development environment, is slightly different for the lifecycle that is described earlier. If you upload a managed file in a workspace, that file is only available in that workspace. The file is not available to other workspaces or people by using the production-ready data until the workspace is committed.

From a workspace, a managed file has the following lifecycle:
  1. A user chooses the workspace task that they work on.
  2. The use uploads the file by using the catalog and marketing attachments tools in WebSphere Commerce Accelerator or the fileloader utility and the file is stored in the workspace database schema.

    The managed file is only available to users of the same workspace and can be seen only by using the store preview function.

  3. The workspace is committed to the production-ready data.

    The managed files are in the WebSphere Commerce EAR file and available for viewing from store pages.

  4. The managed files are published to the production environment by using the fileprop utility.

Managed files that are published from an authoring server to a production server are not copied to the WebSphere Commerce database on the production server.

Managed directories

Managed directories are created by using IBM Management Center or WebSphere Commerce Accelerator. If a managed directory is created in a workspace, it is visible from all workspaces in the system. Similarly, the managed directory can be manipulated and deleted from any other workspace.