||
Skip to end of metadata
Go to start of metadata

Optionally, you can add a lifecycle to an asset type at the time of creating the asset type, by defining the lifecycle in the RXT definition. If you have not defined a lifecycle when creating an asset type, you can add a lifecycle by attaching the lifecycle to the asset type.

Follow the instructions below to attach a lifecycle to an asset type:

  1. Create the shell of an asset extension. For more information, see Creating the Shell of an Asset Extension.

  2. Define an asset.configure callback method in the asset.js file within the asset extension. The assets directory of the Publisher and Store asset extension are as follows:

    ES ComponentDirectory
    Publisher<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/assets/<ASSET_TYPE_NAME>
    Store<ES_HOME>/repository/deployment/server/jaggeryapps/store/extensions/assets/<ASSET_TYPE_NAME>

    The <ASSET_TYPE_NAME> should always correspond to an asset type that exists in ES, which has a corresponding RXT definition in the registry.

  3. Attach the lifecycle for the asset type in the meta section.

     meta: {
         lifecycle: {
             name: '<LIFECYCLE>',
    		 defaultLifecycleEnabled: true
         }
     }
    • name - Defines the default lifecycle to be used for the asset type.

      • If defaultLifecycleEnabled: true

        • If a lifecycle has been defined in the asset type RXT definition, then ES ignores the lifecycle defined in the asset extension (asset.js) and uses the lifecycle defined in the RXT as the default lifecycle. 

        • If a lifecycle has not been defined in the asset type RXT definition, then ES uses the lifecycle defined in the asset extension (asset.js) as the default lifecycle.

      • If defaultLifecycleEnabled: false
        If this property is set to false, ES will not attach a lifecycle to this asset type.

    • defaultLifecycleEnabled - Defines which lifecycle is used with the specific asset type. If the defaultLifecycleEnabled property is true, then the default lifecycle, which is specified in the asset extension, is used as the lifecycle for the asset type. However, if the defaultLifecycleEnabled property is false, the lifecycle defined in the asset type RXT definition is used.


    Example:
    Attach the lifecycle, which is namely MobileAppLifeCycle, to the asset type. 

     meta: {
         lifecycle: {
             name: 'MobileAppLifeCycle',
    		 defaultLifecycleEnabled: true
         }
     }

    The finalized asset.js file should look as follows:

    asset.configure = function() {
        return {
            meta: {
                lifecycle: {
                    name: 'MobileAppLifeCycle',
    			    defaultLifecycleEnabled: true
                }
            }
        };
    };
  4. Restart the ES server, so that ES evaluates the changes in the asset.js file.

 

  • No labels