Portal Applications

3d com Navigator

Developing a Driver

How to develop a driver in the Portal
Use Case

Abstract

This article discusses the CAAPLBADriverPst use case. This use case explains how to implement the interfaces in order to create a new driver.


What You Will Learn With This Use Case

This use case is intended to help you develop a Driver in ENOVIA Portal.
Its main intent is to allow you to access and expose hierarchical data.
The data for this use case comes from a pst format file, that is an ENOVIA VPM format used to store a product structure.
We will define three types of data:

[Top]

The Driver Implementation Use Case

CAAPLBADriverPst is a use case of the CAAPortalBaseApps.edu framework that illustrates the ENOVIA CATJDataAccessBasicModel framework capabilities.

[Top]

What Does CAAPLBADriverPst Do

This driver provides the end user with a query tool to his data. From the query results, the user can bookmark any item in the results list. Then the user can navigate through the tree structure represented by this bookmark.

These data come from the pst files located in a path given as a parameter to the driver.

[Top]

How to Launch CAAPLBADriverPst

Before launching ENOVIA Portal and using the new driver, you have to compile it and declare it in some environment files.

  1. Compilation
  2. Environment files for the driver
  3. Driver Use
Compilation

You have to compile the java files and make a jar file thanks to the mkmk command.

[Top]

Environment files for the Driver

In order to add this new driver, you have to modify:

The original files must be copied from the official RuntimeView in:

Windows InstallRootServerDirectory\intel_a\docs\java
Unix InstallRootServerDirectory/$OS/docs/java

For help purpose, modified files are provided in:

Windows InstallRootDirectory\CAAPortalBaseApps.edu\Data.d\DriverPst
Unix InstallRootDirectory/CAAPortalBaseApps.edu/Data.d/DriverPst

At last, the modified files must be put in:

Windows InstallRootDirectory\JAVA\docs\java
Unix InstallRootDirectory/JAVA/docs/java

instead of the existing ones.

Additionnally a mkCreateRuntimeView command must be performed so that all additional resources are copied to the RuntimeView.

dsar.properties

Modification of the dsar.properties file to register the new jar file in the CATlet where this jar will be used:
in BookmarkTreeCATlet dependencies (you have to increment the number of dsar):

...
CLASS: com.dassault_systemes.catweb.bookmarktree.BookmarkTreeCATlet
PortalBookmarkTree.dsar
...
CAAPLBADriverPst.jar
...
Driver.properties

Modification of the Driver.properties file to add the new driver:
This file contains the list of all the drivers and the information to use it.
Increment the number of drivers.

group=13
...

You must specify the path of the class that implements the Driver2 interface.

...
group.12.element=1
group.12.name=Pst Driver
group.12.element.0.classname=com.dassault_systemes.CAAPortalBaseApps.CAAPLBADriverPst.PstDriverImpl
group.12.element.0.label=Pst Driver

You have the possibility to specify different parameters, each parameter is composed of a keyword and a value. These parameters are given to the driver at the execution ( more details will be provided in the implementation of the Driver2 interface).

Caution: in parameter.0.value, make sure that you replace the InstallRootDirectory occurence by your real installation path (this parameter indicates the location of the input pst files).

group.12.element.0.nbParameter=1
group.12.element.0.parameter.0.keyword=PstFilesPath
group.12.element.0.parameter.0.value=InstallRootDirectory/CAAPortalBaseApps.edu/CNext/docs/sample/pstFiles
SearchProject.xml

To add the bookmark "DriverPst queries" and the sub-bookmark "Query all" in the Search Tree ( to access the driver query window), you have to add this lines in SearchProject.xml.:

...</BOOKMARK></folder>
<folder NAME="DriverPst queries">
<BOOKMARK NAME="Query All" 
url="http://localhost/casta/type.com.casta.generic.Query/?CATLET_TYPE=JAVAQUERYTOOL&amp;Specification=Query_PstDriver">
</BOOKMARK></folder>
...
</Tab></SerializedData>

[Top]

Driver Use

Step 1 - Launch ENOVIA Portal and select the Search Tree workbook

Note the new "DriverPst queries" bookmark that has appeared in the Search Tree workbook. If you cannot see it, the reason may be that you see a previous version of the Search Tree workbook. To update the Search Tree workbook: delete it and add it again.

Step 2 - Open the "DriverPst queries" bookmark, right click on the "Query All" sub-bookmark and select "Activate".

Note that as a result the "SampleDriver Query" CATlet has been instantiated in the webspace.

Step 3 - Enter the % query string in the SampleQuery Driver CATlet and press the submit button.

As a result, the list of all the .pst files located in the PstFilesPath is displayed.

Step 4 - Double-click on the "SampleStructure1.pst" result and select the Search Tree workbook as target workbook

Note that as a result a bookmark to the selected result is created in the Search Tree workbook.

Step 5 - Open the "shortcut of SampleStructure1.pst" bookmark and navigate in the product structure by opening the different nodes.

Note that you can display the properties of each leaf or node of the hierarchical tree by clicking on the Properties tab of the webtree.

[Top]

Where to Find the CAAPLBADriverPst Code

The CAAPLBADriverPst use case is made of five classes named:

in the java package named com.dassault_systemes.CAAPortalBaseApps.CAAPLBADriverPst

These classes are located in the CAAPLBADriverPst.mj module of the CAAPortalBaseApps.edu framework:

Windows InstallRootDirectory\CAAPortalBaseApps.edu\CAAPLBADriverPst.mj\src\com\dassault_systemes\CAAPortalBaseApps\CAAPLBADriverPst
Unix InstallRootDirectory/CAAPortalBaseApps.edu\CAAPLBADriverPst.mj/src/com/dassault_systemes/CAAPortalBaseApps/CAAPLBADriverPst

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

[Top]

Step-by-Step

To create a driver for data access, there are eight main steps.

  1. Reading the Input Data Using BrowserServices
  2. Implementing the Interface Driver2
  3. Implementing the Mandatory Interface SecurityIF
  4. Implementing the Mandatory Interface EnvironmentIF
  5. Implementing the Mandatory Interface MetadataIF
  6. Implementing the Mandatory Interface DataIF
  7. Implementing the Optional Interface persistantDataIF, to Bookmark
  8. Creating the File Query_SampleDriverPst.properties

[Top]

Reading the Input Data Using BrowserServices

The hierarchical data for this Driver come from a pst file. This file will be parsed to construct hash tables containing the data for the use case.

...
public class PstParser
{
  public static Hash table _nodeChildHashtable  = new Hashtable();
  public static Hashtable _attributesHashtable = new Hashtable();
...

To access a file you have to use the class com.dassault_systemes.catweb.tools.browser.BrowserServices. This class encapsulates specificities of Java Virtual Machines and different browsers.
From a file name it returns a File Object and a FileInputStream Object then a BufferReader constructed from this stream enables the parsing.

...
  public PstParser( String iFilePath, String iFileName)
  {
    try
    {
      if( !(_parsedPst.contains(iFileName)) )
      {
        BrowserServices   bs                  = BrowserServices.get();
        File              file_src            = bs.getFile(iFilePath+File.separator+iFileName);
        FileInputStream   fileInputStream_src = bs.newFileInputStream(file_src);
        InputStreamReader inputStream_src     = new InputStreamReader(fileInputStream_src);
        BufferedReader    source              = new BufferedReader(inputStream_src);
...  

[Top]

Implementing the Interface Driver2

Creation of a new class PstDriverImpl which implements the interface com.dassault_systemes.catweb.databackend.dataType.Driver2.

...
public class PstDriverImpl implements Driver2
{
  // An interface in order to get some services on the driver
  private DriverServicesIF _servicesIF = null ;

  //The Frame window containing the Portal
  private Frame _frame = null ;

  // Mandatory interfaces known by the driver
  private defaultSecurityIFImpl    _security   = null ;
  private defaultEnvironmentIFImpl _environment = null ;
  private PstMetadataImpl          _metadata   = null ;  
  private PstDataImpl              _data       = null ;

  // Optional interface known by the driver
  private PstPersistantDataImpl _persistantData = null ;  
  
  // Path to the pst files, only for the use case
  private String _pstFilesPath = null;
...  

The goal of the Driver2 interface is to provide all the services required by a driver.
This interface provides methods dealing with:

Driver2 interface also enables the Driver to get the interfaces to access and manage the data.

Before the instantiation of the Driver, the Portal retrieves the information, possibly set as parameters, in the Driver.properties file. This information is given to the Driver, just after its instantiation, with the setParameter method (iKeywordValues contains the information) and could be used in the lifecycle of the Driver. For more details see Configuration of the Driver.
For this use case, the information retrieved from the Driver.properties file is the location of the pst files.

...
  public void setParameter(KeywordValue[] iKeywordValues) 
  {
    String pstFilesPath_tmp = iKeywordValues[0].getValue();
    _pstFilesPath = pstFilesPath_tmp.replace('/', File.separatorChar);
  }
...

Life Cycle:

A driver is instantiated through the traditional static method java.lang.class.forName. Then the start method is called with an InformationObject parameter which provides all the information it needs for its life: the Frame, the DriverServicesIF interface.
The java.awt.Frame is a the top-level window containing the Portal.
The DriverServicesIF interface allows the driver to display text in the "Messages" window with the setText method.
At the end of the session, the driver is called on stop.

...
  public void start(InformationObject iInformation)
  {
    if (iInformation!=null)
    {
      java.lang.Object obj1=iInformation.getProperty("Frame");
      if (obj1!=null)
      { 
        _frame=(Frame)obj1;
      }
      java.lang.Object obj2=iInformation.getProperty("DriverServices");
      if (obj2!=null)
      {
        _services=(DriverServicesIF)obj2 ;
        _services.setText("PstDriver started");
      } 
    }
    ...
  }
...

Identity:

Just after the start method, it is asked to give its system identity. The System identity will be used to store some persistant information about data. So be careful, don't change it after you release the driver into production.
This name must be the same as the label defined in Driver.properties.

...
  public String getName()
  {
    return "Pst Driver"; 
  }
...

Licensing:

Then the licensing is checked. ENOVIA Portal lets you decide whether the licensing for this driver is ok. ENOVIA Portal does not own the licensing because in fact , you can prerequisite another licensing system (for example, the PDM System when you run some of its libraries) and it will not be aware of this.

...
  public boolean isLicensingOK()
  {
    return true ;
  }   
...

Access to other interfaces:

ENOVIA Portal needs to retrieve the implementations of the four mandatory interfaces from the driver:

Moreover if you want optional services like bookmarking on the driver, you have to implement the corresponding optional interface:

The objects implementing the interfaces can be instantiated in the start method.

...
  public void start(InformationObject iInformation)
  {
    ...
    _security       = new defaultSecurityIFImpl();
    _environment    = new defaultEnvironmentIFImpl();
    _metadata       = new PstMetadataImpl();
    _data           = new PstDataImpl(_metadata, _pstFilesPath);
    _persistantData = new PstPersistantDataImpl(_metadata, _pstFilesPath);
  }
... 

The four mandatory interfaces are returned to ENOVIA Portal by the Driver, with get methods.

... 
  public SecurityIF getSecurityIF()
  {
    return (SecurityIF)(_security) ;
  }

  public EnvironmentIF getEnvironmentIF()
  {
    return (EnvironmentIF)(_environment) ;
  }

  public MetadataIF getMetadataIF()
  {
    return (MetadataIF)(_metadata) ;
  }

  public  DataIF getDataIF()
  {
    return (DataIF)(_data) ;
  }
...

The getSupportedInterface method enables ENOVIA Portal to ask for any optional interface by its full java class name.

...
  public java.lang.Object getSupportedInterface(String interfaceName) 
  {
    if(interfaceName.equals("com.dassault_systemes.catweb.databackend.dataType.persistantDataIF"))
      return _persistantData;
    else
      return null;
  }
... 

Anyway, only this optional interface is available, in the current code version.

[Top]

Implementing the Mandatory Interface SecurityIF

The driver is asked for its SecurityIF interface whose implementation checks the security or licensing. There are 3 calls on this interface.

This use case uses a default implementation of SecurityIF: defaultSecurityIFImpl. In this default implementation, isUserChecked always returns true.

[Top]

Implementing the Mandatory Interface EnvironmentIF

If you want to organize data into Environments, you have to use this interface. For example, you may use 2 types of parts object, parts targeted for the production, and others for the marketing. Then you can define an environment for producing parts and another for marketing parts. These different environments implies different attributes, for example the producing parts contain the attributes "name", "type", "maturity" and the marketing parts the attributes "name", "color". The end-users will choose which environment they need. So, there will be one PEType: "part" with two sets of PEAttributes for each environment. Every PENode or PELeaf of this type has to belong to one of this two environments. The environment of a PENode or a PELeaf is contained in its Uuid.
This interface contains three methods:

There is no environment in this use case, it uses a default implementation of EnvironmentIF: defaultEnvironmentIFImpl. In this default implementation, getEnvironmentList returns the environment "default" and the user will not choose an environment.

[Top]

Implementing the Mandatory Interface MetaDataIF

The purpose of this interface is to describe the types of data managed by the driver.
The data could have different types. For example this driver will provide 3 types of objects: part, model and the third type is the file (.pst) that contains the structure.
A new class: PstMetadataImpl is created to implement the interface MetadataIF.
This interface contains one method: getTypes, which returns an array of PEType Objects.

...
public class PstMetadataImpl implements MetadataIF
{ 
  private PEType[] _aType = null ;

  public PEType[] getTypes()
  {     
    if( _aType == null)
    {
      _aType = new PEType[3];
...

There are three parameters to construct the different PETypes of this system.

...
      _aType[0] = new PEType("PART_LIST", false, "Resources/I_BodyYellow.gif");
      _aType[1] = new PEType("CATIA_MODEL", false, "Resources/iDBmodel01.gif");
      _aType[2] = new PEType("PST_FILE", true, "Resources/iDBdocument01.gif");

      int[] aFileQuery = new int[2] ;
      fileQuery[0]=0;
      fileQuery[1]=1;
      types[2].setSupportedQueries(aFileQuery);
...

Each type of data (PEType) is described by different attributes: the PEAttributes.

A PEAttribute is defined by:

Then the PART_LIST type is described by 4 attributes: NAME, MATURITY, DATE, CREATOR.
The visible name of a PENode or PELeaf, in the WebTree, is the concatenation of the values of visible attributes. That's why you have to indicate the visibility of each attribute: 1 means that the attribute is visible, 0 means the attribute is not visible (more generally, the visibility value indicates the position in the visible name). Thus, in the use case, the visible name of a node that is a PART_LIST type, is only composed of the value of the "NAME" attribute.

...
      PEAttribute[] aPartAtt = new PEAttribute[4];

      aPartAtt[0] = new PEAttribute("NAME","Name",_aType[0],0);
      aPartAtt[0].setTreeVisibility(1); //visible

      aPartAtt[1] = new PEAttribute("MATURITY","Maturity",_aType[0],0);
      aPartAtt[1].setTreeVisibility(0); //not visible

      aPartAtt[2] = new PEAttribute("DATE","Creation date",_aType[0],0);
      aPartAtt[2].setTreeVisibility(0); //not visible

      aPartAtt[3] = new PEAttribute("CREATOR","Creator",_aType[0],0);
      aPartAtt[3].setTreeVisibility(0); //not visible
	 
      _aType[0].setAttributes(aPartAtt);
...

If you allow extended query on a PEType, you have to indicate which PEAttributes can be used in the query by specifying operators for these attributes.
Here an extended query is allowed on the size attribute of a pst file since the operators less, equal and greater are associated with this attribute.
You can also specify help values or authorized values for the operand with the setHelpValues and setAuthorizedValues methods.

...
      PEAttribute[] aPstFileAtt = new PEAttribute[4];

      aPstFileAtt[0] = new PEAttribute("NAME","Name",_aType[2],0);
      aPstFileAtt[0].setTreeVisibility(1);

      aPstFileAtt[1] = new PEAttribute("PATH","Path",_aType[2],0);
      aPstFileAtt[1].setTreeVisibility(0);

      aPstFileAtt[2] = new PEAttribute("SIZE","Size",_aType[2],0);
      aPstFileAtt[2].setTreeVisibility(0);
      String[] operators = {"<=","=",">="};
      aPstFileAtt[2].setOperators(operators);

      aPstFileAtt[3] = new PEAttribute("RIGHTS","Rights",_aType[2],0);
      aPstFileAtt[3].setTreeVisibility(0);
	 
      _aType[2].setAttributes(aPstFileAtt);
...

[Top]

Implementing the Mandatory Interface DataIF

The DataIF interface enables the display and the query of data. It is implemented in a new PstDataImpl class instantiated by the driver. Two methods have to be implemented:

...
public class PstDataImpl implements DataIF
{ 
  // Instance of the interface MetadatIF, to know the types
  private MetadataIF _metadata = null;

  // Path to the pst files for this use case
  private String _pstFilesPath = null;

  public PstDataImpl(PstMetadataImpl iMDimpl, String iPstFilesPath)
  {
    _metadata = iMDimpl;
    _pstFilesPath = iPstFilesPath;
  }
...

The QueryRoot method concerns the data whose type has been declared queryable in the implementation of the MetadataIF interface. QueryRoot searches the objects which meet the conditions expressed by a query and which belong to a specified environment.
The query may be simple (Search String) or more complex (Extended Query). In this case it is in the form of an array of (operand, operator, value)); the operands and the possible operators having also been defined in the implementation of the MetadataIF interface.
For this use case, the simple query (Search String) and the Extended Query are only supported, for the PEType "file pst".

...
  public PELeaf[] QueryRoot(java.lang.Object iSearch, PEType iTypeOfObject, String iEnvironment)
  {
    BrowserServices bs  = BrowserServices.get();
    // Get the directory containing the pst files
    File directory      = bs.getFile(_pstFilesPath);
    // Get the list of the file in this directory
    String [] aFileList = directory.list();

    PELeaf[] aNodesToBack  = null;
    Vector nodesToBack_tmp = new Vector();

    for( int i=0; i<aFileList.length; i++)
    {
      // the search is only performed on the pst files
      if ( aFileList[i].indexOf(".pst") != -1 )
      {
...

The simple query is done on the pst file name. The string " % " is the wildcard which gives access to all the pst files.

...
	if( iSearch instanceof String )
	{
	  String stringSearch = (String)(iSearch);
	  if( stringSearch.equals("%") ||
	      fileList[i].equals(stringSearch) )
	  {
	    File pstFile = bs.getFile(_pstFilesPath+File.separator+aFileList[i]);
...

The attributes of the returned PELeaf are set to the PELeaf (or PENode) with the setAttributeValues method. The array of String containing these attributes has to be filled in the same order as the order used to set the attributes in the PEType in PstMetaDataImpl.

...
	    String[] aPstFileAtt = new String[4];

	    aPstFileAtt[0] = aFileList[i];   //Name
            aPstFileAtt[1] = _pstFilesPath;  //Path
            aPstFileAtt[2] = Long.toString(pstFile.length());  //Size
            aPstFileAtt[3] = (pstFile.canRead()?"r":"") + (pstFile.canWrite()?"w":"");  //Rights

	    PENode pstFileNode = new PENode(new defaultUuidImpl(aFileList[i]),iTypeOfObject,null);
            pstFileNode.setAttributeValues(aPstFileAtt);
	    
	    nodesToBack_tmp.addElement(pstFileNode);
	  }
	}
...

The extended query involves only the size attribute of the pst file, with the operators "<=", "=" and ">=".

...
	else
	{
	  ElementOfQuery[] extendedSearch = (ElementOfQuery[])(iSearch);
	  try
	  {
	    File pstFile = bs.getFile(_pstFilesPath+File.separator+aFileList[i]);
	    long sizeAttribute = pstFile.length();
	    for (int j=0; j<extendedSearch.length; j++)
	    {
	      String operator = extendedSearch[j].getOperator();
	      Long operand = Long.valueOf(extendedSearch[j].getOperand());
	      if( (operator.equals("<=") && sizeAttribute <= operand.longValue())||
		  (operator.equals("=" ) && sizeAttribute == operand.longValue())||
		  (operator.equals(">=") && sizeAttribute >= operand.longValue()) )
	      {
		String[] aPstFileAtt = new String[4];

                aPstFileAtt[0] = aFileList[i];   //Name
                aPstFileAtt[1] = _pstFilesPath;  //Path
                aPstFileAtt[2] = Long.toString(sizeAttribute);  //Size
                aPstFileAtt[3] = (pstFile.canRead()?"r":"") + (pstFile.canWrite()?"w":"");  //Rights

		PENode pstFileNode = new PENode(new defaultUuidImpl(fileList[i]),iTypeOfObject,null);
		pstFileNode.setAttributeValues(aPstFileAtt);

		nodesToBack_tmp.addElement(pstFileNode);
	      }
	    }
	  }
	  catch(NumberFormatException e)
	  {
	    e.printStackTrace();
	  }
	}
      }
    }
    aNodesToBack = new PELeaf[nodesToBack_tmp.size()];
    nodesToBack_tmp.copyInto(aNodesToBack);
    return aNodesToBack;
  }      
...

The openNode method must return the children of a Node. This method is called each time the user clicks on a node to open it.
In this use case, only pst file and PART_LIST are nodes, and could be opened.
If a pst file node is opened, it returns the PART_LIST node which is the root of the product structure.

...
  public PELeaf[] openNode(PENode iNode)   
  {
    PEType[] aTypes        = _metadata.getTypes();
    PELeaf[] aNodesToBack  = null;
    Vector nodesToBack_tmp = new Vector();
	
    String nodeUuid = ((defaultUuidImpl)(iNode.getUuid())).getIdent();

    if ( (iNode.getType().getName()).equals("PST_FILE") )
    {
      PstParser pst = new PstParser(_pstFilesPath, nodeUuid);

      String partListRootUuid = (String)(PstParser._rootPartHashtable.get(nodeUuid));
      String[] attributes = (String[])(PstParser._attributesHashtable.get(partListRootUuid));

      String[] aPartAtt = new String[4];
      aPartAtt[0] = attributes[2];  //Name
      aPartAtt[1] = attributes[3]+"%";  //Maturity
      aPartAtt[2] = attributes[4];  //Date
      aPartAtt[3] = attributes[5];  //Creator

      PENode partList = new PENode(new defaultUuidImpl(partListRootUuid),aTypes[0],null);
      partList.setAttributeValues(aPartAtt);

      nodesToBack_tmp.addElement(partList);
    }
...

If a PART_LIST node is open, the children are PART_LIST or CATIA_MODEL.
A PART_LIST is represented by a PENode whereas a CATIA_MODEL is representedby a PELeaf since it doesn't have children.

...
    else
    {
      //gets the identifiers of the Part_List that are children of the node
      String[] partListChild = (String[])(PstParser._nodeChildHashtable.get(nodeUuid));

      for( int i=partListChild.length-1; i>=0; i--)
      {
        String[] attributes = (String[])(PstParser._attributesHashtable.get(partListChild[i]));

	if( attributes[1].equals("PART_LIST") )
	{
	  String[] aPartAtt = new String[4];
          aPartAtt[0] = attributes[2];  //Name
          aPartAtt[1] = attributes[3]+"%";  //Maturity
          aPartAtt[2] = attributes[4];  //Date
          aPartAtt[3] = attributes[5];  //Creator

	  PENode partList = new PENode(new defaultUuidImpl(partListChild[i]),types[0],null);
	  partList.setAttributeValues(aPartAtt);

	  nodesToBack_tmp.addElement(partList);
	}
	else //it is a CATIA_MODEL
	{
	  String[] aModelAtt = new String[4];
          aModelAtt[0] = attributes[2];  //Name
          aModelAtt[1] = attributes[3];  //Type
          aModelAtt[2] = attributes[4];  //Date
          aModelAtt[3] = attributes[5];  //Creator

	  PELeaf catiaModel = new PELeaf(new defaultUuidImpl(partListChild[i]),types[0]);
	  catiaModel.setAttributeValues(aModelAtt);

	  nodesToBack_tmp.addElement(catiaModel);
	}
      }
    }

    aNodesToBack = new PELeaf[nodesToBack_tmp.size()];
    nodesToBack_tmp.copyInto(aNodesToBack);

    // Attaches the children to the father Node
    iNode.setChildren(aNodesToBack);

    return aNodesToBack ; 	       
  }   
}

Note that the children must not only be returned by the OpenNode method but also be set to the input code.

[Top]

Implementing the Optional Interface persistantDataIF, to Bookmark


The persistantdataIF contains the methods used to bookmark data in the WebTree.
Two methods have to be implemented:

...
public class PstPersistantDataImpl implements persistantDataIF
{
  // Instance of the interface MetadatIF, to know the types
  private MetadataIF _metadata = null;
 
  // Path to the pst files for this use case
  private String _pstFilesPath = null;
  
  public SamplePersistantDataImpl(SampleMetadataImpl iMDimpl, String iPstFilesPath )
  {
    _metadata = iMDimpl;
    _pstFilesPath = iPstFilesPath;
  }
...

isQueryableByUuid returns a boolean indicating if the PENode or the PELeaf is bookmarkable.
The information stored in the bookmark is:

For this use case, all the data are bookmarkable.

...
  public boolean isQueryableByUuid(Uuid iObjectRequested, String iTypeName, Context iContext)
  {
    return true;
  }
...

restoreFromUuid returns the bookmarked PELeaf. The information given to restore the PELeaf are:

...
  public PELeaf restoreFromUuid(Uuid iObjectRequested, String iTypeName, Context iContext)
  {
    PELeaf   leaf  = null;
    PEType[] types = _metadata.getTypes();
    String   uuid  = iObjectRequested.getIdent();
 
    if( iTypeName.equals("PST_FILE") )
    {
      BrowserServices bs = BrowserServices.get();
      File pstFile = bs.getFile(_pstFilesPath+File.separator+uuid);

      String[] aPstFileAtt = new String[4];
      aPstFileAtt[0] = uuid;  //Name
      aPstFileAtt[1] = _pstFilesPath;  //Path
      aPstFileAtt[2] = Long.toString(pstFile.length());  //Size
      aPstFileAtt[3] = (pstFile.canRead()?"r":"") + (pstFile.canWrite()?"w":"");  //Rights

      
      leaf = new PENode(new defaultUuidImpl(uuid),types[2],null);
      leaf.setAttributeValues(aPstFileAtt);
    }
    else 
    {
      String fileName = uuid.substring(uuid.lastIndexOf("'")+1);

      PstParser pst = new PstParser(_pstFilesPath, fileName);

      if( iTypeName.equals("PART_LIST") )
      {
        String[] attributes = (String[])(PstParser._attributesHashtable.get(uuid));
        String[] aPartAtt = new String[4];
        aPartAtt[0] = attributes[2];  //Name
        aPartAtt[1] = attributes[3]+"%";  //Maturity
        aPartAtt[2] = attributes[4];  //Date
        aPartAtt[3] = attributes[5];  //Creator

        leaf = new PENode(new defaultUuidImpl(uuid),types[0],null);
        leaf.setAttributeValues(aPartAtt);
      }
      else if( iTypeName.equals("CATIA_MODEL") )
      {
        String[] attributes = (String[])(PstParser._attributesHashtable.get(uuid));
        String[] aModelAtt = new String[4];
        aModelAtt[0] = attributes[2];  //Name
        aModelAtt[1] = attributes[3];  //Type
        aModelAtt[2] = attributes[4];  //Date
        aModelAtt[3] = attributes[5];  //Creator

        leaf = new PELeaf(new defaultUuidImpl(uuid),types[1]);
        leaf.setAttributeValues(aModelAtt);
      }
    }          
          
    return leaf;
  }
}

[Top]

Creating the File Query_PstDriver.properties

The Query_PstDriver.properties file is referenced in the "Query All" sub-bookmark that has been defined in SearchProject.xml file. The inner mechanism is that when the "Query All" sub-bookmark is activated, the Query CATlet is instantiated with the Query_PstDriver.properties file as a parameter.

The file Query_PstDriver.properties specifies different properties of the query window:

nameofQuery=SampleDriver Query
...
...
typeOfQuery=Casta.StringSearch
# other solution Casta.ExtendedQuery
...
...
nbTypes=1
Types.0.id=Casta.All
Types.0.driver_id=Sample Driver

[Top]


In Short

This use case demonstrates the way to create a driver in ENOVIA Portal by using interfaces of databackend.dataType.
First the Driver2 interface must be implemented by a new class which must also provide the implementation of mandatory interfaces: MetadatIF, DataIF, SecurityIF, EnvironmentIF, and optional interfaces such as persistantdataIF. Some default implementations are supplied by Dassault Systèmes.
At last, a new property file must describe this driver.

[Top]


References

[Top]


History

Version: 1 [May 2000] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.