Portal XML configuration interface reference

 

+
Search Tips   |   Advanced Search

 


  1. XML input structure
  2. Types of portal resources
  3. Actions on portal resources
  4. Object IDs in XML scripts
  5. Symbolic object IDs and ID generating mode
  6. Lookup of portal resources
  7. Exporting sets of resources
  8. Mandatory and optional attributes
  9. Page layout modifications
  10. Importing WAR files
  11. View update of changes
  12. Transactionality
  13. Error recovery

 

XML input structure

The top level structure of an XML request or response is always as follows:

<?xml version="1.0" encoding="UTF-8"?>
   <request
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="PortalConfig_1.3.xsd"
    type="export|update"> 
      <portal . . . >
      definition of configuration parts to be exported or updated
      </portal>
      <status . . . >
      success or failure indication for the processing
      </status>
   </request>

Main request element specifies the XML schema used by the XML configuration interface. always use the schema reference that is shown in the example, that is a reference with no namespace to the schema "PortalConfig_1.3.xsd". All XML requests must conform to this schema. For your reference, you can find the schema declaration in PORTAL_DIR/doc/xml-samples/PortalConfig_1.3.xsd. Before you send requests to the portal, you can verify them against this schema using a suitable editor or parser to ensure syntactic correctness. The schema also contains annotations that give detailed information on the meaning and possible values of all configuration entries.

The type attribute indicates whether the XML request contains specifications for exporting or for updating portal resources.

The portal section describes the parts of the portal configuration that should be exported or updated.

The status section is optional; in an XML response it indicates success or failure of the requested operation. If a status element is present in a XML request, the server simply ignores it.

The simplest request that you can send to a server is the following:

   <?xml version="1.0" encoding="UTF-8"?>
      <request
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:noNamespaceSchemaLocation="PortalConfig_1.3.xsd"
      type="export"> 
         <portal action="export"/>
   </request>

This request exports the entire configuration of the portal. You can look at the contents of the response to see how the configuration of individual portal resources, such as portlets or pages, is represented in XML elements and attributes.

 

Types of portal resources

The portal resources are represented by the following XML tags:

portal

Main element of every XML request. This element must always appear exactly once and supports only locate and export actions.

global-settings, services-settings

Global portlet configuration values and for specific portal services. These elements support only locate and export actions.

Leave the XML scripts for exporting and updating these settings unchanged. Do not manually change the values in the XML scripts, as this might result in invalid portal configurations. To modify these settings, use the appropriate administration portlets instead after the XML update of a configuration.

task

Schedules the cleanup, that is the final deletion, of portal pages that have been marked for deletion and all their dependent resources.

This tag has the following attribute which is of type string:

bean

Class name of the program that runs in this task. The default is ejb/wpsSchedulerTask. If you specify only this attribute and none of the following subtags, the cleanup is performed immediately when you run the XML script.

If you want to schedule the cleanup at regular intervals, set a scheduling interval by using one of the following subtags. These subtags are optional. Both of these subtags are numerical. They are mutually exclusive, therefore specify only either one of them.

dayOfMonth

Specify a number from 1 to 31. If the number you specify is higher than the last day of the month, the cleanup is performed on the last day of the month. Example: By a value of 31 the cleanup is run on the 28. February, the 31. March, the 30. April, and so on.

dayOfWeek

Specify a number from 1 to 7, where 1 is equivalent to Monday, 2 to Tuesday etc., 7 is Sunday.

If you set a scheduling interval, also specify the starting time. Use the following subtag to do this:

startTime

This subtag is mandatory if you set a scheduling interval using the dayOfMonth or dayOfWeek subtags. Use this subtag to specify the time of day at which you want the cleanup to start. Use the format HH:MM . Specify a value from 0:00 to 23:59 . You do not need to specify the leading zero, for example in 4:45 . To schedule a daily cleanup, use this subtag only without using the dayOfMonth or dayOfWeek subtags.

The Task.xml example shows you how to schedule the cleanup of pages that have been marked for deletion.

Note: If you delete a page with an object ID and then use the XML configuration interface to re-create the same page with the same object ID, you might receive an application error when browsing the re-created page.

virtual-resource

Virtual resources in the access control subsystem. These are resources that only have access control definitions attached, but are not otherwise represented in the portal. The virtual resource PORTLET_APPLICATIONS, for example, allows you to give users access to all installed portlets, but does not correspond to an actual portlet. The virtual resource element supports only update and export actions.

markup

Definition of markup types that the portal pages support.

client

Definition of client devices, how they are detected, and which markups and features they support.

user

Users in the portal user repository. The definitions include their properties, for example the user's preferred language, and portal access control settings that apply to users, for example, who is allowed to administer them. The XML configuration interface allows setting the password for a user, but it does not export the password. The password attribute is required for creating new users. Therefore you cannot directly use the response file from an XML export request to create new users; add a password attribute to the XML first.

You can either specify the name attribute of users and groups with a full DN (distinguished name) as in uid=wpsadmin,cn=users,... , or with a short ID as it is used for portal login, for example wpsadmin. An XML response file from a portal export request always contains full DNs.

With regards to the user tag there are two special cases for which you have to specify particular attributes, depending on the task you want to perform:

  • Exporting users and groups
  • Deregistering users and groups from the portal.

Both cases are described in the following sections.

Exporting users and groups: A full portal export does not normally include user and group information, but only if you explicitly specify in your XML request that the user is to be exported. If you want to export all user and group information, set the export-users flag on the main request tag to true as follows:

      <request . . . export-users="true" . . .>

Notes:

  1. Searching for users or groups is a time consuming task. A search might time out or return more results than the system can handle or the user might expect. To prevent this behavior, you can limit searches for users or groups by setting a timeout or a maximum number of search results. For more information on how to do this, see Set limits on searches for users and groups.

    For more information about managing portal users see Managing users and groups.

  2. The values of some attributes of the tag user correspond to settings in included parameter tags. If you include both in your export request, but specify different values for them, then the value set by the parameter tag overwrites the value set by the attribute, and is exported as the attribute. The values of the attributes of the user tag correspond to the included parameter tags as follows:

    Attribute parameter tag with name=" " Comments
    firstname givenName
    lastname sn
    name uid
    common name   cn This attribute is mandatory.

    Example: You can define the first name of a user at creation by using either the attribute firstname or the parameter tag with the givenName attribute. If you use both and specify two different names, then the value specified by givenName is exported as the attribute firstname.

    Example XML export request:

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Description of this command file: Create 1 users -->
    <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_1.3.xsd" 
                      type="update" create-oids="true">
         <portal action="locate">
             <user action="update" firstname="John_1" password="password" lastname="Miller" name="John's name">
                 <parameter name="givenName" type="string" update="set">John_2</parameter>
             </user>
         </portal>
    </request>
    

    This request sets the value John_2 for the firstname attribute.

Deregistering users and groups from the portal: If portal users or groups have been removed from the user registry, but not from the portal database, or if users have been muted, for example after too many wrong password attempts, you can export these users and groups for later removal by using the cleanup-users attribute with the request tag. To export these users and groups, set the cleanup-users flag on the main request tag to true as follows:

      <request . . . cleanup-users="true" . . .>

If you set this property to true, all users and groups that no longer exist in the configured user repository, such as LDAP, are exported with their action set to delete. You also need to set the export-users attribute to true.

Before re-importing the file, review and edit the result file and remove all users and groups that you want to keep in the portal database. During XML import all users and groups that remain listed in the file will be removed from the portal database.

After deleting these entries via the modified XML script, all customization is lost for the deleted users and groups.

The CleanupUsers.xml sample XML file shows you an example for exporting those users and groups.

group

Groups in the portal user database. The definitions include portal access control settings and membership information, for example, which users belong to the group. See under user just above for more information on how to handle groups in XML.

For more information about managing portal groups see Managing users and groups.

event-handler

Definition of programming code inside the portal that should be notified when certain events occur in the portal, for example, when a page is created. Describes the name of the Java class and the events that should be reported.

skin

Describes the visual appearance, for example, the border of individual user interface elements, for example, of portlets on a page. Skins can be assigned to content nodes and components.

theme

Describes basic properties, for example, colors and font type, of the appearance of an entire group of pages. Themes might restrict the selection of possible skins on the associated pages. Themes can be assigned to content nodes.

web-app

Web modules which correspond to a deployed WAR file. To use them in the portal, one or more (concrete) portlet applications must be defined that describe specific settings. In a portlet.xml deployment descriptor, this element corresponds to the portlet-app tag.

JSR 168 Web modules can contain only one single portlet application, whereas non-JSR 168 Web modules can contain more than one portlet application. For IBM V4.x API portlets, the uid attribute must match the uid defined in the deployment descriptor. For JSR 168 portlets, the uid attribute must be constructed by the uid attribute of the portlet-app subelement and a .webmod suffix. Example:

    <web-app action="update" active="true" removable="true" uid="jsr_bookmarks_id001a.webmod"> 
         . . . . .
    <portlet-app action="update" active="true" uid="jsr_bookmarks_id001a">   

Depending on the path location of your WAR files, previously exported WAR files might not be found during an XML import due to incorrect path information. For information about how to use the <url> subtag with the <web-app> tag refer to Importing WAR files.

servlet

Servlets that are defined in the Web module. They are created as part of the WAR file deployment and cannot be created or deleted explicitly, therefore the create and delete actions are not supported. In a portlet.xml deployment descriptor, this element corresponds to the portlet tag.

portlet-app

Portlet applications that are contained in a Web module or a WSRP Producer and contain specific settings. Usually, applications and their contained portlets are defined in the WAR file of the Web module and are created by the portal during deployment. For IBM V4.x API portlets, this element corresponds to the concrete-portlet-app tag of the portlet deployment descriptor.

For JSR 168 compliant portlets, the uid attribute must match the ID of the portlet-app element defined in the deployment descriptor. If the id attribute is not set in the deployment descriptor, specify the WAR file name.

When the application is used in a WSRP context, the portlets that are contained in the application are defined remotely and can be integrated by using the XML configuration interface. In this case portlet applications need to define a groupid attribute.

After you have deployed a WAR file locally or integrated a WAR file as a WSRP service, you can also create additional portlet applications (and the contained portlets) with different settings. This is also known as copying or cloning the portlet application.

portlet

Portlets that can be placed on a page and contain specific settings. Normally, portlets are defined in the WAR file of the Web module and are created by the portal during deployment. When the portlets that are contained in the Web module are used in a WSRP context, they are defined remotely and are integrated by the XML configuration interface. In this case portlet applications need to define a handle attribute. A new flag, provided , has been introduced for providing portlets for remote invocation and withdrawing them.

When you create a new portlet in an additional application, it must refer to one of the servlets that was defined in the Web module. In a portlet.xml deployment descriptor, this element corresponds to the concrete-portlet tag.

If you write JSR 168 compliant portlets, not use the parameter tag to add parameters; use the preferences tag instead.

content-node

An element in the content hierarchy of the portal. The portal supports several types of content nodes:

Page Nested layout elements and displays portlets.
Label Organizes the content hierarchy but does not display portlets.
Internal URL Points to other portal content
External URL Points to a Web page outside the portal.

All content nodes in the portal are organized in a hierarchy; at the root of this hierarchy is the special content node wps.content.root. A content node of the type page can be derived from another parent content node so that it partially overrides or extends the layout of its parent. While the portal and the portlet for Working with pages always display an aggregation of a composition layer and all of its ancestors, the XML configuration interface must manage every layer separately.

Always export and replace an entire stack of page layers and not to use XML requests to modify individual layout components or derived page layers. In particular, do not try to manually create XML scripts for the definition of derived pages, as the reference structure is quite complex. Instead, use the portlet for Working with pages to edit page layouts, and then export the result into an XML response file.

For more information about managing portal pages see Managing pages, layout, and content.

For more information about aggregation see Aggregation.

component

A layout component inside a page. The portal supports two types of components:

  • A container is a row or column container that aggregates child containers.
  • A control component contains a portlet instance.

If you update an existing page with an XML script and the script specifies components inside that page, the layout-processing attribute of that page defines how those new components interact with the existing layout of the page.

portletinstance

An individual occurrence of a portlet on a page. The portlet instance includes the user-defined portlet data that was set using the edit mode of the portlet.

Notes:

  1. A portlet instance is always contained in a component of type control; deleting a portlet instance automatically deletes the component in which the portlet was contained.
  2. Instances of JSR 168 portlets must not use the parameter tag to add parameters; they must use the preferences tag instead.

wire

Represents a property broker wiring between two portlet instances on a page. A wire connects a source and a target portlet instance, so that values which change in the source are propagated to the target.

credential-segment

Groups a collection of credential entries for a specific back end credential store (vault). The configuration of credential segments cannot be modified after they have been created.

For more information about credential segments see Credential Vault and Credential Service and Portlet authentication.

credential-slot

A single credential entry that describes information required to connect to a protected resource outside the portal. The XML configuration interface covers only the definition of the credential slot. The actual credential, for example a password, is stored in the back end credential store and is therefore not accessible by the XML configuration interface

For more information about the credential vault concept see Credential Vault and Credential Service and Portlet authentication.

url-mapping

Allows to define arbitrary URL spaces that map to portal content.

wsrp-producer

This is the Web Services for Remote Portlets (WSRP) Producer definition on the Consumer side. It allows an administrator to integrate remote portlets that are provided by the WSRP Producer.

If you work online, you can connect to the WSRP Producer and access the WSDL document of the Producer. In this case specify at least the wsdl-url subelement with the wsrp-producer element.

If you work offline, that is you cannot connect to the Producer, specify at least the URLs of the Producer Service Description and Markup interfaces.

After a WSRP service has been integrated, the portal handles it like a regular local portlet. For example, you can add the portlet to pages.

The following tags are for portal internal use only. If you encounter these tags in an XML export script that you want to use for later update, do not change these tags or their content in any way.

action-set

For WebSphere Portal internal use only.

resource-type

For WebSphere Portal internal use only.

protected-resource

For WebSphere Portal internal use only.

transformation-app

For WebSphere Portal internal use only.

transformation

For WebSphere Portal internal use only.

transformationinstance

For WebSphere Portal internal use only.

Note that the XML configuration interface only manages resources of the portal core and not those of additional components, such as Portal Personalization.

 

Special configuration data entries

Additional to the tags representing portal resources as listed above, XML provides the following tags for special purposes:

localedata

Describes locale specific data associated with portal resources. The localedata element allows a number of child elements (title, description and keywords), but not all of them are supported for all portal resources. Unsupported child elements are ignored. The charset attribute is only used in markup elements.

When you create XML files that contain lots of translated texts in different languages, it is sometimes more convenient to specify those texts in properties files instead of including them in the XML script. Therefore you can alternatively use a URL to specify a properties file. XML will then read the title, description, and keyword texts from that file.

parameter

Describes name-value pairs associated with portal resources. The parameter element supports a type attribute, but for all elements except portlet instances, the type must be string. Portlet instances additionally support the binary type which treats the parameter contents as Base 64 encoded binary data. User definitions support setting multiple values for the same parameter name. With all other resources, setting a parameter overwrites any previous value stored under the same parameter name.

If the WSRP Producer requires a registration of the WSRP Consumer with certain registration properties, specify these properties as parameters.

preferences

This is a derivation from the name/value pair. It relates to the parameter element. It describes name/multivalue combinations, that is, combinations of a name and one or more value child elements that are associated with the portal resources wsrp-producer, portlet, and portlet-instance.

Notes:

  1. The value elements support only string type attributes, no binary ones.
  2. Set a preferences value overwrites all values that were previously stored under the same preferences name.
  3. portlet and portlet-instance can only have the preferences element if they are JSR 168 compliant. For all other portlets, use the parameter element.
  4. If the WSRP Producer requires a registration of the WSRP Consumer with certain registration properties, specify these properties with the parameter tag.

Optionally, you can use the preferences element to define which user attributes you want to have transferred in the WSRP communication with the Producer. These user attributes are the user attributes that are defined in LDAP.

access-control

Describes the access permissions associated with portal resources. By specifying access-control subsections for resources in the XML, you can, for example, define which users or groups are allowed to manage a resource. The access control definition for a resource includes all of the following information:
  • The owner of the resource
  • The roles defined on that resource
  • The mapping of users or groups to a role
  • Whether inheritance of a role or from the parent resource or to child resources is blocked.

Alternatively, a resource can be a private resource of a specific owner, or it can be managed externally.

When you specify users or groups in the access-control section of a resource, you can either use the full DN as in uid=wpsadmin,cn=users,... , or the short ID as it is used for portal login, for example wpsadmin. An XML response file from a portal export request always contains full DNs.

When you change the access control state of a resource from public to private or vice versa, this also affects all the resources that inherit access control from this resource. You can never have a public resource that inherits access control from a private resource.

For more information about this refer to Enable security and Security Concepts.

objectid

Almost all resources in the portal have an object ID, which identifies the resource. The object ID allows to address the resource unambiguously. It is also used to express references from one resource to another. For example, when a theme is assigned to a page, the configuration of the page includes the object ID of the theme. See the Object IDs in XML scripts section on object ID handling in XML scripts for more information.

uniquename

A resource that has an object ID can optionally also have a unique name. The unique name can then also be used to identify the resource unambiguously, because a unique name can be used only once in a portal installation.

If you execute an XML update that assigns a unique name which is already used on the system, the execution will fail. You can delete the unique name for a resource by setting it to the value undefined. When you create unique names in XML scripts that you run on many different portal installations, for example to install add-on portlets and pages, use a specific prefix for any unique names that you assign, to minimize the chances that they clash with existing unique names on the system. For example, the prefix wps. is used for all unique names that are created as part of the portal installation.

When you create a nested element, for example a component, with a uniquename attribute, the whole hierarchy upward from that element must also have uniquename attributes. Example XML export request snippet:

     <content-node ...
          <component uniquename="component_1"...
               <component uniquename"component_2"...
                    <component uniquename"component_3"...
                         . . . . .
                    </component>
               </component>
          </component>                       
     </content-node>

Failing to do so might result in the following error message:

    XMLC0142E: Unique name unique_name is already used in the portal.

ordinal

The client and component resources take an ordinal attribute which represents the sorting order. (In the case of client resources, if more than one client entry matches a connecting device, the entry with the higher ordinal takes precedence.)

When ordinals for resources are set in an XML script, you have the following options for specifying them:

  • As a plain integer value. In this case, the value is written to the database. The resource is sorted into the position that this ordinal value has relative to the ordinals of existing siblings. For example, if you create a new page with ordinal="350" under an existing label, and there are already other pages under that label with the ordinals 100, 300 and 500, the new created page will appear in the third position. If you specify an ordinal which has already been assigned to an existing resource, the order of the two resources cannot be predicted.
  • As a position indicator. You specify this with a hash mark ( # ), followed by an integer value. In this case the resource is inserted in the sequence of resources at the position indicated by the specified value. For example, if you create a new page with ordinal="#2", it will appear in the second position in its content parent.
  • The special values first and last. In this case, a value is chosen so that the resource is sorted at the first or last position in its content parent.

An XML export response file always contains the literal ordinal values as they are stored in the portal database. Note that specifying a position indicator or special value will not necessarily produce the desired effect if you are working with derived pages, because in these cases the order of elements depends on the individual user viewing the portal.

You can find additional information on the meaning and possible values for configuration elements and attributes in the schema annotations.

 

Actions on portal resources

All XML elements that represent portal resources have a required action attribute. The action attribute of XML elements determines what type of processing is applied to the portal resources. The following actions are allowed:

Action Resulting processing
locate Identify the portal resource corresponding to this XML element (usually required as a context for other actions).
create Create a new portal resource with the given attributes. A new resource is always created, even if another resource with the given name already exists.
update Update the configuration of the corresponding portal resource with the given configuration data (attributes and dependent configuration data elements); if no corresponding portal resource can be found, it is created.
delete Delete the portal resource corresponding to this XML element.
export Include an XML representation of the portal resource corresponding to this element in the output of the XML command.

Example: the following XML snippet sets the portlet "MySpecialPortlet" to inactive status:

   <portlet name='MySpecialPortlet' action='update' active='false'/>

 

Syntactic restrictions on the input syntax

There are certain restrictions on the allowed values for the action attribute:

  • If the request type was specified as update, only the actions locate, create, update and delete are permitted.
  • If the request type has been specified as export, only the actions locate and export are permitted.
  • Create actions (and update actions for non-existing elements) might require that certain attributes of the element are defined that are not required for other update or delete actions.
  • Actions of nested elements must not be contradictory. If you choose to delete a resource, you cannot create any other resources inside it. The following table lists all commands, together with the allowed commands for subelements:

    Action Allowed actions in subelements
    locate locate, create, update, delete, export
    create locate, create, update
    update locate, create
    delete no subelements allowed
    export no subelements allowed

Two or more XML elements might correspond to the same portal resource. For example, it is possible to have one element that creates a portal resource and another that updates the same resource with new configuration data.

Configuration data elements do not have an associated action, but most of them have an update attribute that determines the type of update that is applied. The following values are possible:

update Resulting processing
set The corresponding configuration data (for example, parameter) is set, or, if it does not yet exist, it is created.
remove The corresponding configuration data (for example, parameter) is removed

Note that configuration data elements are processed only if their parent has an update action. For example, the following fragment will not update the capability information for the given page:

   <client uniquename="smart.browser" action= "locate">
        <client-capability update="set">HTML_JAVASCRIPT</client-capability>
   </composition>

 

All specified actions are processed in the textual order in which they are specified in the XML input (document order). If there are any interdependencies between the actions, the user (or program) providing the XML input is responsible for ordering the elements correctly.

 

Object IDs in XML scripts

All resources in the portal (except for the portal and the settings resources) are identified by a unique object ID generated by the portal when the resource is created. These object IDs are represented by the objectid attributes in an XML export.

References between resources are represented by these object IDs. The portletinstance tag has a portletref attribute that corresponds to the objectid attribute of the portlet. Consequently you see the following snippets in an XML export:

   <portlet action="update" . . . 
            objectid="_3_609EVJDBI1S5CD0I_97 Welcome Portlet" . . . >
       . . .

   <portletinstance action="update" . . . 
            portletref="_3_609EVJDBI1S5CD0I_97 Welcome Portlet" . . . >

Note that the object ID is represented by the _3_609EVJDBI1S5CD0I_97 part of the attributes. Everything after the first space is of no significance and is just additional explanatory output that is included in the export. The purpose of this "comment" is to make the XML export response file more readable, so that you can immediately see that the page containing the portlet instance displays the welcome portlet, without having to search through all portlets for the object ID _3_609EVJDBI1S5CD0I_97.

All resources get an object ID assigned in the portal when they are created. That object ID can not be altered later. When you create new resources in the portal administrative user interface, they automatically get a new object ID generated by the portal. When you create a new resource with XML, it also always gets a new object ID, if you do not specify one in the XML. Note that you can not simply "invent" object IDs for new resources, because they must conform to a correct internal representation. The only way to get valid object IDs is from an XML export.

In XML scripts the objectid attribute of a resource is used for the following purposes:

Action Description
locate
export
update
delete
Look up the resource
create Set the object ID for the resource
update Set the object ID for a the resource if no resource with that object ID exists

Use object IDs to uniquely specify resources that you want to administer. For example, the following snippet deletes a specific known page. (You would normally get the object ID of the page from an XML export.)

   <content-node action="delete" objectid="_6_609EVJDBI1S5CD0I_AA"/>

The following snippet looks up a page with a specific object ID. If it cannot find the object ID, it creates it. If it already exists, it updates it.

   <content-node action="update" objectid="_6_609EVJDBI1S5CD0I_AA" type="page" . . . >

The next snippet creates or updates a theme with a specific object ID and then assigns that theme to a label:

   
        <theme action="update" objectid="_J_609EVJDBI1S5CD0I_89" . . .>
            . . .
        <content-node action="update" objectid="_6_609EVJDBI1S5CD0I_C3" 
                     type="label" themeref="_J_609EVJDBI1S5CD0I_89" . . . >

If the theme already exists with the specified object ID, you can directly use that object ID in references without having to include the theme in the XML script. The next snippet assumes that the theme has already been created. For example, it might have been copied from another server in a previous step. Therefore the snippet only assigns the theme to the label:

   
        <content-node action="update" objectid="_6_609EVJDBI1S5CD0I_C3" 
             type="label" themeref="_J_609EVJDBI1S5CD0I_89" . . . >

In this case, the theme is looked up in the portal datastore using its object ID _J_609EVJDBI1S5CD0I_89. If no theme with that object ID is defined in the portal, you get an error during the XML validation.

An object ID is globally unique. Two object IDs that were automatically generated by different portal installations can never bet he same. Therefore you can exchange resources between different portal installations using XML export and update requests without having to worry about possible object ID conflicts. The only way that you can ever duplicate an object ID is by transferring a resource (including the object ID) to another portal with an XML export and update.

In many cases, this is the desired behavior. However, if you do not want to copy the same resource to another portal, but you want to create a new resource instead, regardless of existing OIDs and without any chance of causing conflicts, either use symbolic object IDs or delete the objectid attribute from the XML script. In the latter case the portal creates a new object ID.

 

Symbolic object IDs and ID generating mode

In some cases, you might need to use objectid attributes to express references between resources in your XML script, but you do not want these to be read from or written to the portal database. In this case, the object ID would be only a symbolic reference inside the XML script. For example, you might want to create a new theme and page, and reference the theme in the page. Nevertheless you want to let the portal chose an object ID for it because you do not want to accidentally overwrite an existing resource.

There are two ways to achieve this:

  • You can switch the XML processing to ID generating mode by setting the create-oids flag on the main request tag:
              <request . . . create-oids="true" . . . >
    

    In this mode, all object IDs are not written to or read from the portal database. Instead, their only purpose is to express the linking between resources in the XML. When the XML processing creates new resources, they are created with a new system generated object ID, not with the object ID specified in the XML.

  • When you use a value for an objectid attribute that cannot be decoded as an object ID, such as a simple string name, the XML processing treats it as symbolic and does not try to use it for looking up the object or write it to the database. This makes it possible to selectively treat individual object IDs as symbolic.

Note that even in symbolic object IDs, anything after the first space is not significant for processing. For example, you could use the following snippet to create a portlet and put it on a page using a symbolic object ID:

   <portlet action="update" . . . objectid="Welcome_Portlet" . . . >
       . . .
   <portletinstance action="update" . . . portletref="Welcome_Portlet" . . . >

As the object ID values are purely symbolic, you cannot use them in a reference without first "defining" them in the same XML script. Before you can use the portletref="Welcome_Portlet" attribute specification in an XML update, also have a portlet with objectid="Welcome.Portlet" defined in the same XML; otherwise a syntax error is reported.

Of course, the object IDs in the XML are also not used for looking up a resource. If you want to refer to existing resource, use a unique name (see below) instead. In ID generating mode, the following snippet locates an existing portlet by its name, "defines" a symbolic object ID for it and places the portlet on a page:

   <portlet action="locate" name="Welcome Portlet" objectid="Welcome.Portlet">
        . . .
   <portletinstance action="update" . . . portletref="Welcome.Portlet" . . . >

As object IDs are not used to identify existing resources in ID generating mode, it is good practice to define unique names for all resources that are created in such scripts. That way, if the script is executed twice, the second execution can find and update the resource by its unique name, instead of creating two identical resources. (See the examples under the topic Working with the XML configuration interface).

When you create resources using symbolic object IDs, it can sometimes be useful to know the actual object IDs of the new resources. You can set the export-mapping flag on the main request attribute to obtain this information:

     <request . . .export-mapping="true" . . . >  

When you set this flag, a mapping section is appended to the XML response. For every symbolic object ID given in the input, this mapping shows the actual object ID in the portal datastore.

The ID generating mode is useful if you want to create an XML script that installs a group of new resources and is executed on many different portal installations. This can be, for example, as part of the installation procedure of a portal add-on that you give out to other parties. In this case, you have no control over the systems on which the XML script is executed, and it is of no interest to you which object IDs the resources actually get.

Use the ID generating mode for all the examples under Working with the XML configuration interface, because they should work on any portal installation.

The identity of the objects that are configured in the XML script is expressed by their object ID. Therefore use "real" object IDs in your scripts, when you want the objects in your XML to retain their identity. For example, when you use an XML export request and the resulting response file to copy a resource from a staging to a production system, the resource is created on the production system with the same object ID as on the staging system. This way you can establish a correspondence between the two resources. When you later transfer the same resource again, the XML processing looks up the resource by its object ID, finds that it already exists, and updates the existing resource instead of creating a new one.

When setting up the target system in such scenarios, use only the XML configuration interface to copy resources from the source system. If you deploy portlets on the target system during the portal installation or if you deploy them using the administration portlets, they will not have the same object IDs as on the source system, so you can run into problems when you later copy other resources that reference them.

 

Lookup of portal resources

XML elements with locate, export, update and delete actions need to refer to existing resources in the portal. Those resources must be identified by specific attributes.

The relevant attribute to identify a resource in the portal is its object ID. Every resource must have an object ID and it must always be unique. Therefore, if you specify an objectid attribute for a resource, and you do not use symbolic object IDs as described above, the resource is looked up by that object ID.

Of course, there are cases where you do not have literal object ID values available when you write your scripts, especially if you are writing scripts that are executed on installations that you are not administering yourself. Therefore you can also specify other identifying attributes to look up resources. If the lookup by object ID fails, the XML processing also attempts to find the resource using other attributes.

An alternative method for looking up portal resources is to use a unique name. Every resource that has an object ID can also have an optional unique name, and the unique name must unambiguously identify the resource. Unique names are useful if you need a symbolic way to identify certain resources. They allow easy porting of configurations between portal installations. In contrast to object IDs, it is possible to modify unique names of resources, which can be an advantage in certain situations. To set a unique name for a resource, use the Custom Unique Names portlet under Administration, Portal Settings.

If a unique name is not given or cannot be found, some resources can also be searched using other attributes. Some resources can be looked up without any attribute information, because they exist only once in their context.

The following table shows the relationship between resources and the attributes you can use for locating them.

Resource key Attributes used for locating the resources
portal, global-settings, services-settings None; these items always exist only once.
markup, virtual-resource, user, group, credential-segment, credential-slot, portlet name
event-handler classname
web-app, portlet-app uid
servlet refid
portletinstance None; there is at most one portletinstance per component.
url-mapping label

In any case the lookup process first tries to find the resource by its object ID, if specified, and then by its unique name, if that is specified. Only when those attempts fail, other attributes are used for locating the resource.

If an objectid attribute is specified in the XML input, but the corresponding resource cannot be found by that object ID but only by another attribute, and if that object ID is used in other parts of the XML script as a reference, those references are mapped to the actual object ID for the resource that was found. In this case the objectid attribute behaves like a symbolic object ID (see above).

 

Exporting sets of resources

You can specify more than one resource with an export action in the same request and thus generate an export response file that contains a selected group of resources, for example several portlets and pages. The XML configuration interface provides two additional features that allow you to export selected subsets of the portal resources:

  • When you export a content node, you can specify the export-descendants attribute for that resource. If you set this attribute to true, the export response file also includes the entire subtree in the content hierarchy that is located below that node. In addition, all derived pages that override the layout of pages in that subtree, are also exported. In other words, this exports all content nodes that can be reached via a chain of content-parentref or derivation-parentref attributes.

    Example: the following fragment exports a subtree of the content hierarchy that starts with the label as specified:

         <content-node uniquename="MyPages" action="export" 
                 export-descendants="true" />   
    
  • All top level resources that can take an objectid attribute, such as markup, virtual-resource, user, group, client, event-handler, web-app, theme, skin, content-node, credential-segment and url-mapping support the asterisk ( * ) as a wild card symbol to be used as a value for the object ID. The asterisk can be used as a wild card symbol only with the export and delete actions. Depending on the action with which it is specified, it exports or deletes all resources of the respective type. Example: the following fragment exports the complete client configuration of the portal:
         <client objectid action="export"/>    
    

A combination of a partial search string and the asterisk is not valid. The asterisk also has no special meaning if it is used as a value for any other attribute.

The XML configuration interface offers no other "query" features, that allow you to export resources based on specific criteria. The only other possibility to export a selected subset of resources is to specify all the resources individually with their object IDs or other identifying attributes in your XML input.

 

Mandatory and optional attributes

Normally, only that part of the configuration data must be specified for an XML element which is necessary for the desired operation. For example, when deleting a portlet, it is sufficient to specify its reference ID to identify it; it makes no sense for this operation (although it is not forbidden), to specify a new active state, since the portlet is removed anyway.

When creating a new portal resource, some required attributes (depending on the type of resource) must be specified. Others can be omitted. They are then set to a default value.

When updating an existing portal resource, all attributes are optional, except those required to locate the element. The omitted attributes are simply left unchanged. In a few cases of page layout attributes, there is the possibility of explicitly specifying an "undefined" value. This means that the attribute is not defined at the respective level, but inherited. For example, if the skin for a component is undefined, it will be inherited from the setting of its page.

Note that there is a semantic difference between the following XML fragments:

<composition name="MyPages" action="update" active ="true"/>

and

<composition name="MyPages" action="update" active ="true" skinref="undefined"/>

The first fragment only modifies the active attribute of the page and leaves its skin setting unchanged; the second fragment additionally resets the skin to the undefined value (whatever the previous skin setting was), so that the page will always display in the portal default skin.

 

Page layout modifications

When you use an XML script to update an existing page and specify a new layout, all elements in the page that existed before, but were not updated, are deleted. The page will only contain those layout components that are specified in the XML script and no remainders of its previous layout.

In particular, this means that if you update a page layout in ID generating mode, all existing components of the page will be deleted and a new layout will be created instead - even if the new layout is identical to the old one ! This happens because components can only be looked up by their object IDs and lookup by object ID is not possible in ID generating mode. Therefore all the components specified in the XML are created, because they cannot be found for updating, and all existing components are deleted because they were not updated.

In the rare case that you actually want to update specific components in the page but do not want to delete the existing page layout, you can turn off this special processing by specifying the attribute preserver-old-layout="true" for the content node.

 

Importing WAR files

To create new portlet applications, additional resources (WAR files) are required. Those files are not included in the XML input. Instead, the XML input contains references to external URLs as in the following example:

     <web-app name="MySpecialPortlet" action="create">
             <url>file://localhost/C:/myportlets/Special.war</url>
     </web-app>

The referenced WAR files must be accessible to the portal when the XML request is processed. When you update a package and specify a <url> sub-element, the WAR file is re-deployed, just as if you had selected the update of a portlet application in the browser. If you intend to deploy the same configuration into several new portals, you can set the URL to http://deploymentserver/path/filename.war . This way there is no need to copy all WAR files to each server machine. The deploymentserver machine needs to be set up properly so that the WAR files can be accessed by http.

An XML export request does not create any required archives. Instead, it only creates pseudo-references in the form of file URLs that rely on the assumption that the file resides in the installableApps subdirectory of the WPS installation. If these assumptions are not met, an exported portal configuration cannot be successfully re-created without editing the generated URLs manually. A backup of a portal configuration requires that the WAR files required for redeployment (which are not used in the running portal) are saved in addition to the XML export.

 

View update of changes

Most portal data is cached on a per-user basis, therefore many modifications become visible to users only after a new logout and login. For example, a page that is created on behalf of users does not immediately become visible to those users if they are currently logged in. Other modifications only become visible after some timeout when internal caches are refreshed with current data. For some settings the portal needs to be restarted to activate the updates. Therefore, if an update you made does not become visible, restart the portal.

In general, the effect of an XML update is the same as if the update was made using administration portlets using a new browser and login session.

 

Transactionality

When you use XML scripts to create, update or delete resources, the changes in the portal database are grouped into transactions. All changes that are part of one transaction are either executed completely or not at all.

The XML configuration has two different levels of grouping database updates into transactions. The grouping is defined by the transaction-level attribute of the main request element, which can have the following values:

resource

Every top-level resource in the XML script is processed in one separate transaction. For example, this can be a content node with its complete layout. If an error occurs, all resources up to the one where the error was encountered have been fully processed; the resource where the error was encountered is not created, or, if it already existed, it is left unchanged. This is the default transaction level.

request

The entire XML script is executed in one transaction. If an error occurs, all database changes caused by the script are made undone, and the original state is restored. Note that using this level of transactionality might cause large and long-running database transactions if used in large XML scripts. As a result, you might encounter database errors caused by exceeding database limits on transaction duration or transaction log size, depending on the configuration of your database.

Transactionality applies only to changes in the portal database. The following aspects of resources are not stored in the portal database and therefore not included in transactions:

  • Enterprise applications for portlets that are deployed into WebSphere Application Server
  • User and group information
  • Role assignments in an external access control system.

An example of what this means is as follows: When you deploy a WAR file in an XML script that uses transaction-level="request" and an error occurs later in the execution of the XML script, the transaction is aborted, so the entries for the portlet are removed from the portal database. However, the corresponding enterprise application has already been deployed into WebSphere Application Server and is not removed. This will not further affect the operation of the portal; you can simply deploy the portlet again later. You will just have an unused enterprise application in WebSphere Application Server. You should remove it manually.

 

Error recovery

If errors occur during the processing of a script, you have generally two options to continue after fixing the cause of the error:

  1. Re-execute the entire XML script.
  2. Remove all resources before the point where the error occurred from the XML script and execute only the rest of the XML script.

If the error occurs during the validation of the XML script, and no resources have actually been processed so far, you can simply re-execute the entire script. You can verify this by reviewing the progress reporting comments in the XML response.

If the error occurs after some resources have actually been processed, the best option depends on several circumstances:

  • If you used the request transaction level, re-execute the entire script, because all changes have been undone.
  • If you used the resource transaction level, the preferable option is to execute only the rest of the XML script, and not to re-execute changes that have already been made; otherwise you might duplicate resources that were already created. You can only use this option if the rest of the XML script does not contain references to the resources that you are removing, that is, if you do not refer to symbolic object IDs of these resources. See Symbolic object IDs and ID generating mode for more information. You can always remove resources that have already been processed from the XML script, if your script uses only hard-coded object IDs for references, because in this case all references can be resolved by looking up the object IDs in the portal database.

To make error recovery easier, use scripts that can be re-executed partially or completely without the possibility of duplicating resources. You do that by specifying an object ID or another identifying attribute on every resource in the script and by using only update actions. See Mandatory and optional attributes for more information on how to specify attributes. This way resources are simply overwritten with the same configuration if they have already been created.

 

See also

Home |

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.