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 OS.
Before you begin to work with scripts for composite applications, ensure that the following conditions are met:
The additional Script Beans for composite applications are Application, ArchivedApplication, ApplicationCategory, and TemplateCategory.
- 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 OS 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 can optionally enable the run-time log for Portal Scripting Interface by setting this trace string: com.ibm.wps.scripting.*=all
From a command line, use the Portal Scripting Interface to run the commands for composite applications:
- Log in as a portal administrator:
Jython: Portal.login(user_ID,password)
JACL: /$Portal login user_ID password
- To list all application categories, run this command:
Jython: Application.listall("categories")
JACL: /$Application listall categories
- To list all active applications by their GUIDs, run this command:
Jython: Application.listall("applications")
JACL: /$Application listall applications
- To list all active applications within a particular category, run this command:
Jython: Application.listall("applications", "categoryis", category_ID)
JACL: /$Application listall applications categoryis category_ID
- To retrieve the details of an application, run this command:
Jython: Application.details(applicationID)
JACL: /$Application details applicationID
- To retrieve the title of an application in a particular language, run this command:
Jython: Application.nlsget(application_ID, "title", locale)
JACL: /$Application nlsget application_ID title locale
- To retrieve the attributes for an application, run this command using the parameters that specify application attributes:
Jython: Application.getattribute(application_ID, attribute_name)
JACL: /$Application getattribute application_ID attribute_nameUse the preceding command to retrieve the values of the following application attributes:
categoryReturns the ID of the category to which the application belongs.
lastaccesseddateReturns the date on which the application was last used, in the format YYYYMMDDHHMMSS.
lastmodifieddateReturns the date on which the application was last modified, in the format YYYYMMDDHHMMSS.
ownerReturns the display name of the application owner.
sizeReturns the size of the application.
- To backup an application, run this command:
Jython: Application.backup(application_ID)
JACL: /$Application backup application_ID
- To archive an application, run this command:
Jython: Application.archive(application_ID)
JACL: /$Application archive application_ID
- To delete an application, run this command:
Jython: Application.delete(application_ID)
JACL: /$Application delete application_ID
- To restore an archived application from the specified restore point, run this command:
Jython: ArchivedApplication.restore(application_IDapplication_restore_point_ID)
JACL: /$ArchivedApplication restore application_ID application_restore_point_ID
- To delete a single restore point of an application, run this command:
Jython: ArchivedApplication.delete(application_ID , "applicationrestorepointis", application_restore_point_ID)
JACL: /$ArchivedApplication delete application_ID applicationrestorepointis application_restore_point_ID
- To delete all restore points associated with an application, run this command:
Jython: ArchivedApplication.delete(application_ID)
JACL: /$ArchivedApplication delete application_ID
- To list all archived application categories, run this command:
Jython: ArchivedApplication.listall("categories")
JACL: /$ArchivedApplication listall categories
- To list all archived applications by their GUIDs, run this command:
Jython: ArchivedApplication.listall("archivedapplications")
JACL: /$ArchivedApplication listall archivedapplications
- To list all archived applications within a particular category, run this command:
Jython: ArchivedApplication.listall("archivedapplications", "categoryis", category_ID)
JACL: /$ArchivedApplication listall archivedapplications categoryis category_ID
- To retrieve the details of an archived application, run this command:
Jython: ArchivedApplication.details(application_ID)
JACL: /$ArchivedApplication details application_ID
- To retrieve the title of an archived application in a particular language, run this command:
Jython: ArchivedApplication.nlsget(application_ID, "title", locale)
JACL: /$ArchivedApplication nlsget application_ID title locale
- To retrieve a list of strings that represent the restore points for the archived application, run this command:
Jython: ArchivedApplication.listapplicationrestorepoints(application_ID)
JACL: /$ArchivedApplication listapplicationrestorepoints application_ID
- To retrieve the attributes for an archived application, run this command: using the parameters that specify application attributes:
Jython: ArchivedApplication.getattribute("archivedapplication", application_ID [,"applicationrestorepoint", application_restore_point_ID], attribute_name
JACL: /$ArchivedApplication getattribute archivedapplication application_ID [applicationrestorepoint application_restore_point_ID] attribute_name
Optional parameter: [,"applicationrestorepoint", application_restore_point_ID] or applicationrestorepoint application_restore_point_ID is optional.Use the preceding command to retrieve the values of the following application attributes:
categoryReturns the ID of the category to which the archived application belongs.
createddateReturns 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 command:
Jython: TemplateCatalog.deletecategory(empty_category)
JACL: TemplateCatalog.deletecategory empty_categoryUnused categories contain no templates. However, obsolete categories might contain old templates. Ensure obsolete categories do not contain templates before you delete categories. If a template exists in a category that you plan to delete, assign the template to a new category or delete the template.
- To delete unused or obsolete application categories, run this command:
Jython: ApplicationCatalog.deletecategory(category_ID)
JACL: ApplicationCatalog.deletecategory category_IDUnused categories contain no templates. However, obsolete categories might contain old templates. Ensure obsolete categories do not contain templates before you delete categories. If a template exists in a category that you plan to delete, assign the template to a new category or delete the template.
- Run the following command to log out:
Jython: Portal.logout()
JACL: /$Portal logout
Scripts for composite applicationsThe 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, $Restorepoint, and $TemplateCatalog.
Parent
Manage applications
Related tasks
Prepare to migrate composite applications
Portal Scripting Interface