Skip to content

Bundled Resource

Purpose

Bundled Resources service actions. A bundled resource is either a JAR file or data file (CSV, Excel) that is used by Groovy scripts. They are uploaded in the Portal, and can be packaged in an application.

Resource deployment will create a target file using the bundled resource’s definition and copy the content into the file. Un-deployment will ensure the file is removed.

A resource’s id consists of the application key and the bundled resource’s name separated with a dot .

Methods

Binding name: p6.bundled


isDeployed

Returns is the bundled resource has been deployed.

Syntax

boolean p6.bundled.isDeployed(String resourceId)
Example

Packaged

println "MyTestResource deployed? " + p6.bundled.isDeployed("appKey.MyTestResource")

Unpackaged

println "MyTestResource deployed? " + p6.bundled.isDeployed("MyTestResource")


deploy

Deploy the bundled resource identified by its id.

Syntax

boolean p6.bundled.deploy(String resourceId)

Note

If the bundled resource is a jar file it will be added to the classpath and the java classes inside will be loaded automatically.

Example
println "Deploying..."
p6.bundled.deploy("MyTestResource")

undeploy

Undeploy the bundled resource identified by its id.

Syntax

boolean p6.bundled.undeploy(String resourceId)

Warning

If the bundled resource is a jar file, the java classes inside will not be unloaded automatically and a restart of Platform 6 will be required.

Example
println "Undeploying..."
p6.bundled.undeploy("MyTestResource")

resourceProperties

Get the properties associated with a resource identified by its id.

Syntax

Map<String, String> p6.bundled.resourceProperties(String resourceId)
Example
println p6.bundled.resourceProperties("MyTestResource")

listResources

Get a list of all defined bundled resource ids. The list is filtered if the appKey argument is defined.

Syntax

String[] p6.bundled.listResources(String appKey)

Tip

  • If the application key is null, it will return the whole list of bundled resources.
  • If the application key is empty, it will return the Platform 6 bundled resources.
  • If the application key is not empty, it will return the bundled resources associated to the application key.
Examples

List all the bundled resources

println "Resources:\n" + p6.bundled.listResources(null)

Unpackaged items

println "Resources:\n" + p6.bundled.listResources("")

Packaged items

println "Resources:\n" + p6.bundled.listResources("myApp")