WebSphere Portal Server is the IBM-oriented integration and an important platform for collaboration. WebSphere Portal Server to provide users with three types of management methods: Web-based management of Portlet, XML Configuration Interface and Portal Scripting Interface. Web-based management approach requires users to manually Portlet to do a variety of operations, automation management operations should not only apply to simple management operations. XML Configuration Interface required the user to prepare XML configuration file, but the documentation is too much trouble and the lack of flow control, is not flexible enough. Portal Scripting Interface from Version 5.1 are introduced, and version 6.0 has been improved and enhanced, using JACL management approach to the preparation of scripts, pre-relative in two ways, is more flexible. In this paper, a concrete example JACL script to guide the reader through the preparation of the management of Portal Scripting Interface script.
In this paper, the reader should possess a certain degree of WebSphere Portal use and management experience, at the same time should also be prepared with basic knowledge of JACL script.
Portal Scripting Interface is based on IBM WebSphere Portal to provide JACL script management interface. In this paper, the specific JACL scripts for example, introduce you to how to prepare Portal Scripting Interface management script WebSphere Portal.
How to run the Portal Scripting Interface
Portal Scripting Interface is the WebSphere Portal Server to provide the JACL-based management process. At WPS_HOME / bin has a script under wpscript.bat (corresponding to non-windows platform wpscript.sh), it is the WebSphere Portal script management interface. wpscript.bat required to run at the command line, has two ways to use the Portal Scripting Interface:
- Interactive way: at the command line under the input side of JACL script to explain the side of operation, applicable to a number of relatively simple and one-time operation;
- Script submitted by: JACL script prepared in advance, and then JACL script file name as command line parameters afferent implementation, applicable to the complexity of the operation and implementation of required repeat operation.
wpscript.bat way call as follows:
List one run Portal Scripting Interface
wpscript.bat-conntype -password |
Here we have more than orders of the parameters used in the explanation:
- -conntype: connectivity, optional parameters, defaults to SOAP;
- -port: port, corresponding to wpconfig.properties in WpsSoapPort property value;
- -user and-password: used to create the connection user name and password;
- -f: JACL file path name, if the interactive way this parameter is omitted.
Open wpscript.bat, can see its content is very simple, some of the parameters of incoming call wsadmin. WebSphere Application Server are wsadmin script management interface, support JACL and Perl scripts. wsadmin is wpscript.bat the expansion of imported Portal managed object, in the JACL script through to the Portal Management Object method calls to the WebSphere Portal Server implementation management.
PSI offers the following managed object Portal:
- Portal: Portal Login Interface
- Content: the content management interface
- Layout: Page Layout Interface
- Portlet: Portlet Management Interface
- Look: Portal appearance of subject Management Interface
- Access and PacList: these two objects together on the implementation of the ACL Control Portal
This is not the Portal Scripting Interface reference manual, so only the sample used in the objects and methods of introduction. And methods of other objects can refer to WebSphere Portal Information Center, or at wpscript.bat Ways to use help.
Portal Scripting Interface provides a powerful assist feature wpscript.bat sign, the call object methods can quickly help get help, such as $ Content help, will return Content object, as well as it supports all the methods, if the method name with as a parameter, will return a detailed description of the method, such as $ Content help search.
Script sample introduction
This article will guide the user to prepare a JACL script. At Home Under Stock entitled to create a page, WebSphere Portal will then own the My Stock Portlet deployed to this page, and finally on the page to set up permissions so that ordinary users should not visit the page.
Portal Bean-sign at JACL in Portal
Portal Objects Portal provides a log-certified interface. WebSphere Portal log necessary to provide a user name and password, visit the Portal through the JACL script is also required to provide certification information sign, only the first sign after the success of the Portal of the various objects, which is managed by each Portal implementation JACL script must first be to do.
Text editing tools used to create a new document stock.jacl and enter the following:
Log in and achieve a list of 2 Exit Portal
$ Portal login $ Portal logout |
This is already a wpscript.sh can be called the JACL script, simply log in Portal and then quit. JACL to support command-line parameters, we can put Portal Login afferent information through the command line, so Portal username or password changes need not be amended after the JACL script. The revised script is as follows:
3 list log Portal from a command line to receive the user name and password
if ($ argc! = 2) ( puts "Syntax: wpscript sample.jacl exit ) set user [lindex $ argv 0] set pwd [lindex $ argv 1] $ Portal login $ user $ pwd $ Portal logout |
At the back of the presentation, will gradually expand this script to make it complete management capabilities.
Apart from the log to verify interfaces, Portal Object Virtual Portal also provides a selection interface, as follows:
$ Portal setvp
Through this method the user can specify which log in Virtual Portal.
Content Bean-Management Portal content (pages, tags and URL)
Content object is responsible for Portal content management, content here refers to the page tags and URL. Through the Content object we can traverse all Portal pages, tags and URL. Navigate to the page after the operation, you can page through the Content object to create, delete and modify such operation. For instance, it is necessary to achieve at a certain page to deploy a Portlet, it must first pass the interface location to deploy Portlet page.
In the use of this object, we must first clarify the Portal content management is how. In WebSphere Portal, the content is organized into a tree structure, and a non-existent virtual root for the root node. Every page, tag and URL is a node tree. Each node has a globally unique signs, through the traverse and search, you can access the content of each tree node. Portal content can be organized manner through the Web browser, as follows:
Figure 1 WebSphere Portal content structure
Content provided Ways objects can be divided into the following categories:
- Traverse and search: fast and accurate positioning to be specified by node;
- Property: to get and set property nodes, such as uniquename, commonname, language, etc.;
- Life cycle: the node to create, delete, etc.;
- Organizational structure: nodes in the entire organization to change the location of tree.
This paper will combine the examples are just about english and life cycle management approach, and other reference WebSphere Portal Information Center.
Usually in the script on certain designated nodes to operate, must be found before and selected this node. Each node by the overall situation of only uniquename signs. Scripting interface provided the following two types of query method:
$ Content search
search methods are all eligible to return to the list of nodes.
$ Content find
find back are the only one eligible node, if eligible, or more than one node does not exist, find call will fail.
type is the query type, it can be page, label, url, etc., or non-type parameters back in line with the conditions of any type of node.
By inquiries are standard, the following are some commonly used search criteria.
- id: globally unique identification;
- uniquename: globally unique name;
- commonnameis: Node generic name;
- commonnamehas: node common name contains a specific string.
By calling the $ Content help search-types can get a list of search criteria.
This example we want to at My Work directory to create the page, it must first find the My Work node, as follows:
$ Content find label uniquenane "wps.My Portal.My Work" select
Ways to add the final select express to the search node and select the node, after all the operations are directed at this node.
Content provided by the search for pre-designated node and its child nodes of the tree, if not selected in advance which node, virtual node from root to start the search.
Content provided to create and delete the node method.
Create a node:
$ Content create
type can be a page, label, externalurl, express separately to create the page, label and url. At create call can also be combined with public, private and other signs that the pages are created by public or private, such as.
To the parent node as a template page to create a new page:
$ Content derive
name is the name of a new page, id is the ID value of the parent node, only the parent node is shared only when they can call the page.
Delete node:
$ Content delect
Continue to expand stock.jacl, At Home, under the heading for the Stock to create a new page.
At Home Under the list of 4 to create a new page called Stock and selected
# Find and select the Home, a new page of the parent node will be the Home. $ Content find label uniquename "ibm.portal.Home" select Stock # Create a header for the page and select set thePage [$ Content create page "Stock" html public] $ Content select $ thePage |
Portlet Bean-operation Portlet
Portlet object WebSphere Portal provides a Medium Portlet deployment of control, it provides a hierarchical structure Portlet deployment visit. JACL script through access to a Portlet, must first pass Portlet object positioning, then the operation can be carried out accordingly.
Portal Scripting Interface in all of the Portlet is also organized by tree structure, but with the Content different, Portlet organizations have a particular tree structure.
- Portlet organization tree with a root node does not exist for the root;
- All of its child nodes are web module, corresponds to the Portlet's war package;
- The second is application, corresponds to the war contained in the portlet application;
- The third tier is portlet, corresponds to the application contains all the portlet.
- Each web module node structure with the portlet.xml in the organizational structure in line.
Organizational tree structure for the Portlet, Portlet are packaged at the time decided by the Portlet object can not be modified.
Portlet object provides two types of methods, search traversal and operation of property, the specific method calls similar to the same content object. Portlet support these types of inquiries: webmodule, application, portlet, concrete (portlet or application), abstract, all or any. Specific search criteria can refer to $ Portlet help search-criteria output.
Continue to expand our example, we have to search through the Portlet object to My Stock Portlet.
5 search list My Stock Portlet
# Find the My Stock Portlet set pid [$ Portlet find portlet cn "My_Stock"] |
Layout Bean-achieve Portal Page Layout
Layout Page Layout object provides the management interface. We know that Portal's Portlet page is used to place the page can be divided into multiple regions, each placed on a Portlet, Layout object is to provide the corresponding management interface that allows users to control the page and each region Regional deployed Portlet.
To use the Layout object, you must first select an object through the Content page, then Layout object to take effect and point to the page, when dselect after the Layout of the node object is not available.
Let us take a look on the portal page layout management, page layout to allow only two types of components exist, container and control.
- Container can be included in container and control, with the html of the table concept is similar to the equivalent of rows and columns, at $ Layout can create horizontal or vertical container.
- Control nodes are the leaves, corresponding to the portlet.
Here is a portlet contains two pages of the layout of the structure.
Figure 2. Page Layout Structure
Layout object provides three types of method calls,
- Search and traversal, with a similar Content to support the container, control, and all or any query criteria;
- Property operations, the specific reference Info Center;
- Lifecycle management, container or control the creation and deletion.
Create a container:
$ Layout create container
Create a control:
$ Layout create control
Back to the examples in this article, we are on the page to deploy a Portlet. The light of the above example, only required the page to create a container, and in the container to create a control, the structure as follows:
Figure 3. Page layout Stock
Stock list on page 6 at My Stock Portlet deployment
$ Layout create container horizontal select $ Layout create control $ pid |
One of, $ pid Yes My Stock Portlet's id.
Access Bean and PacList Bean-controlled Portal Object ACL
WebSphere Portal provides a comprehensive rights management, one of each object (page, Portlet, etc.) has its own access control list can be set individually for each object which users visit. Access and PacList these two objects in the Portal provides a complete set of access rights management system interface. Clients through these two interfaces, the user at JACL script, can any one can be access to the Portal objects (pages, Portlet, etc.) access control list settings.
Access Control for Content and Portlet effective, to do the corresponding operation at the former must first select the Content node or Portlet.
Object Access control for reading and writing objects, read at the control object by object PacList operation,最后by the Access object to write. Basic steps as follows:
1. Through the Access object to obtain access to the designated target object and loading PacList object.
set acl [$ Access getacl Content [$ Content current]]
$ PacList view acl or $ PacList edit acl
2. PacList provided through the method of operation of access to objects, such as grant, block, unblock and so on.
3. Through the Access object to access the object to write back.
$ Access setacl $ acl
In this example, ordinary users should not visit the page Stock, as follows:
Stock list of 7 settings page access control
set acl [$ Access getacl Content [$ Content current]] $ PacList block User propagation $ PacList block User inheritance $ PacList block PrivilegedUser propagation $ PacList block PrivilegedUser inheritance $ Access setacl $ acl |
So far on the Portal Scripting Interface provides the managed object introduction completed, the following are examples of this paper, a complete script, in the WebSphere Portal Server V6.0 debug through.
Eight complete list stock.jacl
# Stock.jacl if ($ argc! = 2) ( puts "Syntax: wpscript stock.jacl exit ) set user [lindex $ argv 0] set pwd [lindex $ argv 1] $ Portal login $ user $ pwd # Find and select the Home, a new page of the parent node will be the Home. $ Content find label uniquename "ibm.portal.Home" select Stock # Create a header for the page and select set thePage [$ Content create page "Stock" html public] $ Content select $ thePage # Find the My Stock Portlet set pid [$ Portlet find portlet cn "My_Stock"] # On the page My Stock Portlet deployment $ Layout create container horizontal select $ Layout create control $ pid # Set access permissions, ordinary users should not visit the page set acl [$ Access getacl Content [$ Content current]] $ PacList block User propagation $ PacList block User inheritance $ PacList block PrivilegedUser propagation $ PacList block PrivilegedUser inheritance $ Access setacl $ acl puts "The deployment of My Stock portlet succeeded." $ Portal logout |
At the command line run wpscript.sh, as follows:
After a successful run with the administrator log in, the result is as follows:
Figure 5. The administrator of the Portal page after log in
Sign in with normal user access, at Home can not see under the Stock page as follows:
Figure 6. The ordinary user of the Portal page after log in
Portal Scripting Interface In this paper, a brief introduction, WebSphere Portal Server through these objects provides a powerful management interface, the user can interface through which the preparation of a powerful management scripts.