3D PLM Enterprise Architecture |
Webtop |
Using the Portal RegistryUsing the registry of the Portal |
Use Case |
AbstractThis article shows how to use the Portal Registry |
This use case is intended to show how to use the registry of the Portal.
[Top]
The PortalURLSnifferCATlet is a use case of the CAAPortalBase.edu framework that illustrates how an application of the Portal can use the PortalRegistry.
[Top]
For this use case, the PortalURLSnifferCATlet implements the PortalURLListener interface and so, listens to PortalURLEvent on the Hookup. This CATlet listens to PortalURLEvents sent to the Portal desktop. For each PortalURLEvent sent to the Portal, the CATlet displays information extracted of the last PortalURL of the event, and of the PortalRegistry. Be careful, a CATlet never need to listen PortalURLListener. The Portal desktop is the only one component to listen this event. This use case do it only for showing a sample of Portal registry use, and providing an application of PortalURL exchange supervision in the Portal.
The PortalRegistry class is initialized with the MIMEtypes.xml file (and on Windows, it is updated by the native registry). This file describes each MIME Types recognized by the Portal. All the information contained in the MIME Type structure is available by calls on the PortalRegistry class.
[Top]
To launch the PortalURLSnifferCATlet, you will need to set up the build time environment, then compile PortalURLSnifferCATlet along with its prerequisites, set up the run time environment, and then execute the use case [1].
Specify the FilePrefix CAAPLB in the Portal launching command, logon to the Portal and do the following steps:
Reselect the PortalURLSniffer Workbook |
![]() |
[Top]
The PortalURLSnifferCATlet use case is located in the CAAPLBUrlSniffer.mj module of the CAAPortalBase.edu framework: It prerequisites the two modules PLBbase.mj and PLBtools.mj of the framework PortalBase.
Windows | InstallRootDirectory\CAAPortalBase.edu\CAAPLBUrlSniffer.mj\ |
Unix | InstallRootDirectory/CAAPortalBase.edu/CAAPLBUrlSniffer.mj/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
Top]
This use case show how to use Portal Registry (and PortalURL) in order to extract information on MIME Type, and associated command. This use case explains 3 different steps of the Portal registry use:
# | Step | Where |
---|---|---|
1 | Get the MIME Type of a document by the PortalURL, or by the file extension | PortalURLSnifferCATlet .java |
2 | Get the command class and NLS name associated with a MIME Type | PortalURLSnifferCATlet .java |
3 | Get the command instances name for a MIME Type | PortalURLSnifferCATlet .java |
[Top]
The PortalURLSnifferCATlet class implements the PortalURLListener interface, so receives PortalURLEvent and extracts of it the MIME Type information as follows:
package com.dassault_systemes.portalbase.caa.catlet; ... public class PortalURLSnifferCATlet extends CATlet implements PortalURLListener { ... /** * Implementation of the PortalURLListener interface */ public void portalURLSelected(PortalURLEvent event) { ... PortalURL url = event.getPortalURL(nbElement-1); // --- extract the MIME Type value of the PortalURL String mimeType = url.getMIMEType(); ... // --- extracts the MIME Type value of the document by the extension of the file // --- first gets the data extension of the document content in the url String extension = url.getDataExtension(); if (extension != null) { // --- get the PortalMIMETypes defined in the registry for the specified extension PortalMIMETypes portalMIMETypes = PortalRegistry.getMIMETypesForExtension(extension); if (portalMIMETypes != null) { String mimeTypeExt = portalMIMETypes.getType(); ... } } ... } ... } |
The PortalURLSnifferCATlet class implements the PortalURLListener interface. In the method portalURLSelected and, the CATlet reads the last PortalURL of the PortalURLEvent in order to extract information on the MIME Type of the document. The PortalURL class implements a method getMIMEType which returns directly the MIME Type of the document refer to the url. An other way to find the MIME Type of a document, is to use the file extension and to call the getMIMETypesForExtension method of the PortalRegistry class (as the Windows registry).
[Top]
The PortalURLSnifferCATlet gets the command class name and the NLS command name associated to the PortalURL as follows:
package com.dassault_systemes.portalbase.caa.catlet; ... public class PortalURLSnifferCATlet extends CATlet implements PortalURLListener { ... /** * Implementation of the PortalURLListener interface */ public void portalURLSelected(PortalURLEvent event) { ... PortalURL url = event.getPortalURL(nbElement-1); // --- extracts the MIME Type value of the PortalURL String mimeType = url.getMIMEType(); // --- gets the command name associated with this url, otherwise set it to the default one String cmdDesc = url.getCommandName(); if (cmdDesc == null) cmdDesc = PortalMIMECommand.DEFAULT_DESCRIPTION; // --- gets the PortalMIMECommand defined in the registry for the specified mimeType and description PortalMIMECommand mimeCmd = PortalRegistry.getMIMECommandForType(mimeType, cmdDesc); if (mimeCmd != null) { // --- gets the value of the command class name String commandClassName = mimeCmd.getCommandName(); // --- gets the NLS command name String nlsCmdName = mimeCmd.getNLSName(); } ... } ... } |
In the MIME Type structure is defined different commands. Each command has a unique name which can be used for the selection of the destination command of a document. The command description name "default" is reserved by the Portal. It specifies that the associated command is the default one used when no command are specified in the PortalURL query.
The method getMIMECommandForType of the PortalRegistry returns the PortalMIMECommand defined in the MIME Type mimeType with the command name cmdDesc. The PortalMIMECommand class contains the class name or the url of the command, the description of the command and the NLS name.
[Top]
The PortalURLSnifferCATlet gets the instance names of all the commands already instantiated for the MIME Type and command description as follows:
package com.dassault_systemes.portalbase.caa.catlet; ... public class PortalURLSnifferCATlet extends CATlet implements PortalURLListener { ... /** * Implementation of the PortalURLListener interface */ public void portalURLSelected(PortalURLEvent event) { ... PortalURL url = event.getPortalURL(nbElement-1); // --- extracts the MIME Type value of the PortalURL String mimeType = url.getMIMEType(); // --- gets the command name associated with this url, otherwise set it to the default one String cmdDesc = url.getCommandName(); if (cmdDesc == null) cmdDesc = PortalMIMECommand.DEFAULT_DESCRIPTION; ... // --- gets the instances name of all the commands already launched // --- and which are defined in the registry for the specified mimeType and cmdDesc String[] instanceNames = PortalRegistry.getInstancesNameForType(mimeType, cmdDesc); ... } ... } |
The PortalRegistry class returns an array of instance names of the command defined in the MIME Type mimeType with the command name cmdDesc. If a null command description is specified in the method then the PortalRegistry returns an array of all the instance names of all the commands defined in this MIME Type mimeType.
[Top]
The PortalRegistry class implements methods which allow the access to the MIME Type information contained in the MIMEtypes.xml file. For instance, it enables you to find the command associated with a MIME Type by the document extension or by the MIME Type name.
[Top]
[1] | Building and Launching a CAA Enovia V5 Use Case |
[2] | The PortalURL |
[Top] |
Version: 1 [Jan 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.