Hi Shabir, I have documented this in [1]. [1] https://docs.wso2.com/display/ES200/Adding+a+New+Sample+Asset+for+an+Asset+Type+at+Server+Startup
Regards, Mariangela *Mariangela Hills* Senior Technical Writer - WSO2, Inc. http://wso2.com Committer and PMC member - Apache Stratos email:[email protected] | mobile: +94 773 500185 On Fri, Sep 11, 2015 at 3:32 PM, Mariangela Hills <[email protected]> wrote: > I created a JIRA [1] to track this task. > > [1] https://wso2.org/jira/browse/DOCUMENTATION-2366 > > Regards, > Mariangela > > > *Mariangela Hills* > Senior Technical Writer - WSO2, Inc. http://wso2.com > Committer and PMC member - Apache Stratos > email:[email protected] | mobile: +94 773 500185 > > On Fri, Sep 11, 2015 at 10:25 AM, Mariangela Hills <[email protected]> > wrote: > >> Thanks, Shabir! I will add this to the docs! >> >> Regards, >> Mariangela >> >> >> *Mariangela Hills* >> Senior Technical Writer - WSO2, Inc. http://wso2.com >> Committer and PMC member - Apache Stratos >> email:[email protected] | mobile: +94 773 500185 >> >> On Thu, Sep 10, 2015 at 10:47 PM, Shabir Mohamed <[email protected]> wrote: >> >>> Also to be added to *Common Mistakes:* >>> >>> >>> - The *"name" *attribute and the *"overview_name"* attribute, both >>> needs to have the same Value, (Ex: 'RaspberryPi' & 'Raspberry Pi' will >>> not >>> work). *"name"* is the Artifact-Name and "*overview_name*" is the >>> value used when creating the resource path in the registry. >>> >>> >>> ------------------------------------- >>> *Shabir Mohamed* >>> *Software Engineer* >>> WSO2 Inc.; http://wso2.com >>> Email: [email protected] <[email protected]> >>> Mobile: +94 77 3516019 | +94 71 6583393 >>> >>> On Thu, Sep 10, 2015 at 9:10 PM, Shabir Mohamed <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> I have been trying to do $subject and found no relevant documentation. >>>> Hence, I backtracked the path as to how the existing sample-artifacts of >>>> the default asset-types (i.e.: gadget & site) are added when running the >>>> WSO2 - Enterprise Store 2.0. >>>> >>>> *As per my study these are the necessary steps required to do $subject:* >>>> >>>> Say the Asset-type for which we want to add a sample artifact has its >>>> *"RXT"* name as *"device.rxt". **(sample txt attached in the email)* >>>> >>>> 1. *The sample artifacts per asset-type are found at path:* >>>> >>>> - >>>> >>>> *<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/samples/assets* >>>> - Create a folder by the plural-name of the asset-type(rxt) in this >>>> path. In this example we make a folder by the name *"devices"*. >>>> - All sample/default artifacts of asset-type *"device" *shall go >>>> into this folder. >>>> >>>> 2. The parent installation script - *"install.js"* - for all samples >>>> is found at the above mentioned path. Any *"install.js"* scripts found >>>> within sub-folders *(ex: devices, gadgets & sites)* of this path will >>>> over-ride the parent script to perform any specific operations relavant to >>>> that asset-type. >>>> >>>> - copy the sample asset-specific *"install.js"** (attached with >>>> this email)* into the folder created in the previous step. >>>> - search and change the following tags appropriately in the copied >>>> script: >>>> >>>> *<ASSET_LIFECYCLE>* : LifeCycle definition to which >>>> the asset-type *(in this example "device") *needs to be attached to *(ex: >>>> DeviceLifeCycle)*. Should be one of the lifecycle definitions found >>>> inside: >>>> *<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/lifecycles/* >>>> *<ASSET_RXT_NAME>* : The *"rxt"* name of the >>>> asset-type for which the samples are to be made *(in this >>>> example "device"). * >>>> >>>> - Save and close the *"install.js"* script. >>>> >>>> 3. Create a folder by the name of the sample-artifact inside the >>>> asset-specific-parent-folder created in Step 1. In this example lets call >>>> our sample artifact of asset-type *"device"* as *"firealarm"*. We can >>>> continue adding any number of folders *per artifact* of the asset-type >>>> *(ex: >>>> firearm, raspberryPi, arduino & etc)*. Artifact specific details go >>>> into these folders. >>>> >>>> *The folder structure >>>> at- <ES_HOME>/repository/deployment/server/jaggeryapps/publisher/samples >>>> should >>>> look as follows:* >>>> >>>> *.* >>>> >>>> *└── samples* >>>> >>>> * └── assets* >>>> >>>> * ├── devices* >>>> >>>> * │ ├── firealarm* >>>> >>>> * │ │ ├── banner.png* >>>> >>>> * │ │ ├── device.json* >>>> >>>> * │ │ └── thumbnail.png* >>>> >>>> * │ └── install.js* >>>> >>>> * └── install.js* >>>> >>>> >>>> 4. Now we have to specify the asset specific attributes to be used when >>>> creating our sample (firealarm) artifact. These details are provided as a >>>> *"json" >>>> *file with the same name as the asset-type/rxt *(<RXT_NAME>.json)*. >>>> >>>> >>>> - In our example this is found inside the *"firealarm"* artifact >>>> folder as *"device.json"*. For every additional artifact-folder >>>> that is declared, there will be a corresponding *"device.json" *file >>>> with relevant attribute details. *(The one used for declaring >>>> "firealarm" artifact is attached)* >>>> >>>> >>>> - Additionally, any images used for thumbnail & banner views of the >>>> artifact in the store also need to go into the artifact specific folder. >>>> The path to these images need to be given appropriately in the >>>> *<RXT_NAME>.json >>>> *file. (See attached sample for clarity) >>>> >>>> >>>> 5. Make the following additions in the *"publisher-tenant.json"* file >>>> found at path: >>>> >>>> *<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/config* >>>> >>>> >>>> - Add the asset-type *("device" in this example)* to the *"assets"* >>>> unit. >>>> >>>> *"assets":["gadget","site", "device"],* >>>> >>>> - Add the plural-name *("devices" in this example)* of the >>>> asset-type *(by which the folder was made in Step 1)* to the >>>> sub-unit *"collections"* nested under the unit - *"accessible".* >>>> >>>> *"accessible": [{* >>>> * "context": "/_system/governance",* >>>> * "collections": ["gadgets", "sites", >>>> "ebooks", "devices"],* >>>> * "actions": >>>> ["http://www.wso2.org/projects/registry/actions/get >>>> <http://www.wso2.org/projects/registry/actions/get>","http://www.wso2.org/projects/registry/actions/add >>>> <http://www.wso2.org/projects/registry/actions/add>", >>>> "http://www.wso2.org/projects/registry/actions/delete >>>> <http://www.wso2.org/projects/registry/actions/delete>", "authorize"]* >>>> * }],* >>>> >>>> - Add a new "*type"* by the same plural-name of the asset-type for >>>> sub-unit *"assetData" *nested under the unit - *"defaultAssets"*. >>>> >>>> *"defaultAssets": {* >>>> * "root": "/samples/assets",* >>>> * "assetData": [{* >>>> * "type": "gadgets",* >>>> * "ignore": >>>> ["agricultural-land", "intro-gadget-1", "intro-gadget-2", >>>> "gadget-template-explorer", "gadget-explorer", "co2-emission", >>>> "electric-power", "energy-use", "greenhouse-gas"]* >>>> * }, {* >>>> * "type": "ebooks"* >>>> * }, {* >>>> * "type": "sites"* >>>> * }, {* >>>> * "type": "devices"* >>>> * }]* >>>> * },* >>>> >>>> >>>> Now, if you restart the server (WSO2-ES), the new sample artifact >>>> should get created for the specific asset-type. This can be viewed at the >>>> Publisher-UI. The artifact will be listed under the asset-type in the >>>> Store-UI according to the lifecycle state mentioned for the >>>> *"overview_status"* attribute in the *<RXT_NAME>.json* file. In our >>>> example the artifact will be visible in the Store-UI, since we have set the >>>> lifecycle status to *"PUBLISHED"*. >>>> >>>> >>>> *Common Mistakes:* >>>> >>>> - Missing lifecycle definition in path: >>>> >>>> *<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/extensions/lifecycles/* >>>> >>>> >>>> - >>>> *In-appropiate attribute naming in the Asset-RXT file for the >>>> attributes: * >>>> >>>> *Ex: >>>> shortName, singularLabel, pluralLabel, <storagePath>....</storagePath>* >>>> >>>> >>>> Please do inform me of anything that I have missed or included >>>> redundantly. >>>> >>>> Regards >>>> ------------------------------------- >>>> *Shabir Mohamed* >>>> *Software Engineer* >>>> WSO2 Inc.; http://wso2.com >>>> Email: [email protected] <[email protected]> >>>> Mobile: +94 77 3516019 | +94 71 6583393 >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "WSO2 Documentation Group" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/a/wso2.com/d/optout. >>> >> >> >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
