Creating an Asset Type
By Default some asset types are added to WSO2 Enterprise Store(ES). But if you want add your own asset type here are the steps that you need to follow.
Steps :
1. You have to create a RXT definition for the asset type.
2. Add the RXT to ES, so that ES can work with that asset type.
3. Attach the created asset type with a life cycle.
Creating a RXT definition.
Here the asset type I want to add is a mobile app. So I'd be creating a RXT definition for mobile app called mobileapp.rxt
Following is the mobileapp.rxt :
In the RXT definition you can define all the fields you want to see in the UI when adding an asset from the asset type. And you can make a filed required or not or readonly or not etc from the RXT definition.
After creating the RXT definition next is to add the RXT to ES.
Add the RXT to ES
You just have to go to {ES_HOME}/repository/resources/rxts and add the created RXT definition to the directory specified.
After adding the RXT, restart the ES to see the asset type added as an asset type for ES Publisher/Store/Admin console. When you login to the ES as admin you will be able to see the created asset type Mobile App.
Attach the created asset type for a life cycle
As soon as you add a RXT and restart, your asset type will be added a default life cycle. The life cycle has the permissions defined for asset add/update/delete operations. So if you want add a customized life cycle follow the following steps.
You can see the life cycles already added from this Path [ES_HOME]\repository\deployment\server\jaggeryapps\publisher\extensions\lifecycles
So if you want to add MobileAppLifeCycle to the asset type what you have to do is to follow these steps
1. Create a mobileapp folder in the following location :
[ES_HOME]\ repository\deployment\server\jaggeryapps\publisher\extensions\assets
2. Create an asset.js file and define the configure callback as the following :
Here I've attach the mobileapp asset tyoe to MobileAppLifeCycle. After you save the file restart the ES in-order for the changes to get effected.
The default life cycle for all the asset types are defined in [ES_HOME]\repository\deployment\server\jaggeryapps\publisher\extensions\assets\default\asset.js
Until you do the above configurations and change the asset life cycle for your created asset type, the default one will be assigned.
Here I've attach the mobileapp asset tyoe to MobileAppLifeCycle. After you save the file restart the ES in-order for the changes to get effected.
The default life cycle for all the asset types are defined in [ES_HOME]\repository\deployment\server\jaggeryapps\publisher\extensions\assets\default\asset.js
Until you do the above configurations and change the asset life cycle for your created asset type, the default one will be assigned.