Use scripts for composite applications
As an alternative to using the administrative portlets, you can use the composite application scripts provided by the Portal Scripting Interface to retrieve application metadata; to backup, archive, and restore applications; and to delete obsolete categories for templates and applications. The scripts for managing application lifecycle (backup, archive, restore, delete) can be automated to run at specific times using the scheduling utility provided by your operating system. Before you begin to work with scripts for composite applications, ensure that the following conditions are met:
- The Portal Scripting Interface is installed and set up to run the composite application API:
The classpath of the shared library WPSlib contains the Application Infrastructure (ai) scripting JAR files:
- PortalServer_root/base/wp.ai.api/script/shared/app/scripting/wp.ai.api.script.jar
- PortalServer_root/base/wp.ai.io.impl/script/shared/app/scripting/wp.ai.io.impl.script.jar
- You know how to use the Portal Scripting Interface and are familiar with its basic commands, for example, the commands for invoking the scripting tool and logging in and logging out of the scripting tool.
- You have invoked the Portal Scripting Interface for your operating system using the appropriate command, wpscript.bat or wpscript.sh, and have logged in to the product with administrator credentials.
- You have permission to back up, archive, restore, and delete composite applications and to delete template and application categories.
- The composite applications that you are working with have been enabled for backup, archive, and restore.
- You have enabled the run-time log for Portal Scripting Interface by setting this trace string: com.ibm.wps.scripting.*=all
The scripts for composite applications are $Application, $ArchivedApplication, $ApplicationCategory, and $TemplateCategory.
From a command line, use the Portal Scripting Interface to run the scripts for composite applications:
- Log in to the product with administrator credentials:
$Portal login portal_administrator_userID portal_administrator_password
- To list all application categories, run this script:
$Application listall categories
- To list all active applications by their GUIDs, run this script:
$Application listall applications
- To list all active applications within a particular category, run this script:
$Applicationlistall applications categoryis categoryID
- To retrieve the details of an application, run this script:
$Application details applicationID
- To retrieve the title of an application in a particular language, run this script:
$Application nlsget applicationID title locale
- To retrieve the attributes for an application, run this script using the parameters that specify application attributes:
$Application getattribute applicationIDattribute_name
You can retrieve the values of the following application attributes:
- category
- Returns the ID of the category to which the application belongs.
- lastaccesseddate
- Returns the date on which the application was last used, in the format YYYYMMDDHHMMSS.
- lastmodifieddate
- Returns the date on which the application was last modified, in the format YYYYMMDDHHMMSS.
- owner
- Returns the display name of the application owner.
- size
- Returns the size of the application.
- To back up an application, run this script:
$Application backup applicationID
- To archive an application, run this script:
$Application archive applicationID
- To delete an application, run this script:
$Application delete applicationID
- To restore an archived application from the specified restore point, run this script:
$ArchivedApplication restore applicationID applicationrestorepointID
- To delete a single restore point of an application, run this script:
$ArchivedApplication delete applicationID applicationrestorepointis applicationrestorepointID
- To delete all restore points associated with an application, run this script:
$ArchivedApplication delete applicationID
- To list all archived application categories, run this script:
$ArchivedApplication listall categories
- To list all archived applications by their GUIDs, run this script:
$ArchivedApplication listall archivedapplications
- To list all archived applications within a particular category, run this script:
$ArchivedApplication listall archivedapplications categoryis categoryID
- To retrieve the details of an archived application, run this script:
$ArchivedApplication details applicationID
- To retrieve the title of an archived application in a particular language, run this script:
$ArchivedApplication nlsget applicationID title locale
- To retrieve a list of strings that represent the restore points for the archived application, run this script:
$ArchivedApplication listapplicationrestorepoints applicationID
- To retrieve the attributes for an archived application, run this script: using the parameters that specify application attributes:
$ArchivedApplication getattribute archivedapplication applicationID [applicationrestorepoint applicationrestorepointID]attribute_name
The parameter set applicationrestorepoint applicationrestorepointID is optional. You can retrieve the values of the following application attributes:
- category
- Returns the ID of the category to which the archived application belongs.
- createddate
- Returns the backup date represented by the application restore point, in the format YYYYMMDDHHMMSS. Requires the parameter applicationrestorepoint.
- To delete unused or obsolete template categories, run this script:
TemplateCatalog.deletecategory empty_category
Unused categories contain no templates. However, obsolete categories might contain old templates. Make sure that obsolete categories contain no templates before you delete categories. If a template exists in a category that you intend to delete, assign the template to a new category or delete the template.
- To delete unused or obsolete application categories, run this script:
ApplicationCatalog.deletecategory empty_category
Unused categories contain no templates. However, obsolete categories might contain old applications. Make sure that obsolete categories contain no application instances before you delete categories. If an application instance exists in a category that you intend to delete, assign the application to a new category or delete the application.
- When you have finished running scripts, log out of the product:
$Portal logout
- Scripts for composite applications
The Portal Scripting Interface includes scripts for retrieving composite application metadata and for managing application lifecycle. The composite application scripts provide an alternative to using the Application Template Library and the Applications catalog for the tasks that the scripts support. The scripts for composite applications are $Application, $ArchivedApplication, $ApplicationCatalog, and $TemplateCatalog.
Parent topic:
Command reference for Portal Scripting Interface
Related reference
Site management extension of the Portal Scripting Interface