3D PLM Enterprise Architecture |
Webtop |
Receiving a PortalURLReceiving a PortalURL from the Portal |
Use Case |
AbstractThis article shows how receive a PortalURL. |
This use case is intended to show how to receive a PortalURL from the Portal.
[Top]
The FoodStoreCATlet is a use case of the CAAJApplicationFrame.edu framework that illustrates how an application of the Portal can receive PortalURLs. This use case uses the PortalURL and PortalURLHandler classes from the PortalBase framework and the JCAtlet class of the JApplicationFrame framework.
[Top]
For this use case, the FoodStoreCATlet implements a specific interface which allows it to receive PortalURL. The FoodStoreCATlet is defined in the PortalRegistry as a receiver of stock document. The stock document is a new type of document defined for this use case, and which contains a food store stock description. When the Portal receives a PortalURL on a stock document, it searches for the receivers of such documents in the PortalRegistry, finds the FoodStoreCATlet, launches the CATlet and sends it the PortalURL. The FoodStoreCATlet receives a PortalURL on a food stock file, opens it, and modifies its stock
[Top]
To launch the FoodStoreCATlet, you will need to set up the build time environment, then compile FoodStoreCATlet along with its prerequisites, set up the run time environment, and then execute the use case [1].
Specify the FilePrefix CAAGw0 in the Portal launching command, logon to the Portal and do the following steps:
Select the FoodStore Stock File |
![]() |
FoodStore Stock File Opened |
![]() |
[Top]
The FoodStoreCATlet use case is one part of the Food Store use case. The FoodStoreCATlet class is located in the CAAGw0FoodStore.mj module of the CAAJApplicationFrame.edu framework:
Windows | InstallRootDirectory\CAAJApplicationFrame.edu\CAAGw0FoodStore.mj\ |
Unix | InstallRootDirectory/CAAJApplicationFrame.edu/CAAGw0FoodStore.mj/ |
where InstallRootDirectory
is the directory where the CAA CD-ROM
is installed.
Top]
To be able to receive PortalURLs from the Portal, there are two steps:
# | Step | Where |
---|---|---|
1 | Implement the PortalURLHandler interface | FoodStoreCATlet .java |
2 | Associate the bean to MIME Types it recognizes | CAAGw0MIMEtypes.xml |
[Top]
The PortalURLHandler interface allows to programming the CATlet treatment when it receives PortalURLs. A CATlet can receive several PortalURLs in one call. For example, when a end user selects several model files and sends all of them to one viewer. In this use case, the FoodStoreCATlet reads only stock document, and only one at a time, because a stock file defines entirely the stock of the food store. If the CATlet receives several PortalURL in a call, we choice to read the last one. The FoodStoreCATlet class implements the PortalURLHandler interface, as follows:
package com.dassault_systemes.japplicationframe.caa.catlet; ... public class FoodStoreCATlet extends JCATlet implements FoodListener ,PortalURLHandler { ... public void handlePortalURL(PortalURL[] urls) { // --- read urls in order to extract the Food Store stock (read the last one) if ((urls != null) && (urls.length >0 )) { try { // --- read input stream of the PortalURL InputStream input = urls[urls.length - 1].openStream(); // --- create a properties object with the input stream for the model init Properties properties = new Properties(); properties.load(input); // --- cleanup CSO (because it is a new stock) getCSO().empty(); // --- initialize the model with the stock file porperties ((FoodStoreModel)models[0]).initializeModel(properties); } catch(IOException ex) { System.out.println(" Can not read url "+urls[urls.length - 1]); ex.printStackTrace(); } } } ... } |
The FoodStoreCATlet class implements the PortalURLHandler interface, which is composed of only one method handlePortalURL. In this method, the CATlet reads the file represented by the PortalURL in order to customize its stock food items. The CATlet does not need to know the location of the file. It just extracts the file content, by calling the openStream method on the PortalURL, and uses the InputStream. This treatment of the PortalURL is only for stock document, because the FoodStoreCATlet is declared as a receiver only for stock file in the PortalRegistry (see the PortalRegistry use [3]).
[Top]
This step allows to declare new file types and their associated viewers in
the Portal. The xxxMIMEtypes.xml files define the MIME Types recognized by the
Portal, and the applications that can handle these types.
The MIME Type application/stock is defined in the CAAGw0MIMEtypes.xml as
follows:
<MIME-Types> ... <MIME> <Type> application/stock <Command value="default"> com.dassault_systemes.japplicationframe.caa.catlet.FoodStoreCATlet </Command> <Command value="FoodStore"> com.dassault_systemes.japplicationframe.caa.catlet.FoodStoreCATlet </Command> </Type> <Desc> Store stock </Desc> <Extension> stock </Extension> </MIME> ... </MIME-Types> |
This file is the MIMEtypes file taken into account when the Portal is launched with the file prefix "CAAGw0" .
In this declaration the FoodStoreCATlet is defined :
The MIME declaration contains the following information:
See [3] for further information about MIME types.
[Top]
In this use case are presented the two steps that a bean needs to do for receiving PortalURLs from applications of the Portal. The bean must implement the PortalURLHandler interface, because the Portal desktop calls it on the method defined in this interface. If the bean wants to receive PortalURL on a specific file type from the others Portal applications, it need to be defined as a command of the specific MIME Type in the file MIMEtypes.xml used by the PortalRegistry.
[Top]
[1] | Building and Launching a CAA Enovia V5 Use Case |
[2] | Sending PortalURL |
[3] | The Portal Registry |
[Top] |
Version: 1 [Sep 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.