]> OCCT Git - occt-wok.git/commitdiff
Initial revision
authorcas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
committercas <cas@opencascade.com>
Fri, 22 Oct 1999 18:05:40 +0000 (18:05 +0000)
65 files changed:
src/WOKernel/FILES [new file with mode: 0755]
src/WOKernel/WOKernel.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_BaseEntity.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_BaseEntity.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_BaseEntity.lxx [new file with mode: 0755]
src/WOKernel/WOKernel_BaseEntityHasher.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_BaseEntityHasher.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_BasicUnitTypes.hxx [new file with mode: 0755]
src/WOKernel/WOKernel_ClientIterator.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_ClientIterator.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_DBMSystem.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_DBMSystem.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_DevUnit.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_DevUnit.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Entity.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Entity.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Entity.lxx [new file with mode: 0755]
src/WOKernel/WOKernel_EntityIterator.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_EntityIterator.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Factory.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Factory.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_File.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_File.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_File.lxx [new file with mode: 0755]
src/WOKernel/WOKernel_FileLocatorHasher.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_FileLocatorHasher.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_FileType.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_FileType.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_FileType.lxx [new file with mode: 0755]
src/WOKernel/WOKernel_FileTypeBase.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_FileTypeBase.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_FileTypeHasher.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_FileTypeHasher.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_FileTypeKeyWords.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_FileTypeKeyWords.hxx [new file with mode: 0755]
src/WOKernel/WOKernel_GlobalFileTypeBase.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_GlobalFileTypeBase.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_HAsciiStringHasher.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_HAsciiStringHasher.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_ImplDepIterator.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_ImplDepIterator.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Locator.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Locator.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Parcel.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Parcel.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Session.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Session.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Session.lxx [new file with mode: 0755]
src/WOKernel/WOKernel_Station.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Station.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_UnitGraph.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_UnitGraph.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_UnitNesting.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_UnitNesting.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_UnitTypeBase.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_UnitTypeBase.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_UnitTypeDescr.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_UnitTypeDescr.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_UnitTypeDescr.lxx [new file with mode: 0755]
src/WOKernel/WOKernel_Warehouse.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Warehouse.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Workbench.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Workbench.cxx [new file with mode: 0755]
src/WOKernel/WOKernel_Workshop.cdl [new file with mode: 0755]
src/WOKernel/WOKernel_Workshop.cxx [new file with mode: 0755]

diff --git a/src/WOKernel/FILES b/src/WOKernel/FILES
new file mode 100755 (executable)
index 0000000..7e9687a
--- /dev/null
@@ -0,0 +1,3 @@
+WOKernel_FileTypeKeyWords.hxx
+WOKernel_FileTypeKeyWords.cxx
+WOKernel_BasicUnitTypes.hxx
diff --git a/src/WOKernel/WOKernel.cdl b/src/WOKernel/WOKernel.cdl
new file mode 100755 (executable)
index 0000000..35b8ed4
--- /dev/null
@@ -0,0 +1,202 @@
+-- File:       WOKernel.cdl
+-- Created:    Fri 23 Jun 16:12:52 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+package WOKernel
+
+    ---Purpose: WOK Entities Structure 
+    --          
+    --          Notions Implemented Here :
+    --          
+    --          Factories
+    --          Workshops
+    --          Parcels
+    --          Development Units
+    --          Workbenches
+    --          Files in WOK Structure (including Locate)
+
+uses
+    WOKTools,
+    WOKUtils,
+    EDL,
+    TColStd,
+    TCollection,
+    MMgt,
+    GraphTools
+    
+is
+
+-- ENUMERATIONS
+
+    
+    enumeration StationID is SUN, DECOSF, SGI, HP, WNT, MAC, UnknownStation;
+    ---Purpose: liste les stations supportees par WOK
+
+    enumeration DBMSID is DFLT, OBJY, OBJS, UnknownDBMS;
+    ---Purpose: liste les DBs objet supportees par WOK
+
+    class Station;
+    ---Purpose: Manages Stations Operations    
+    
+    class DBMSystem;
+    ---Purpose: Manages DBMS Operations
+
+    class FileType;
+    class FileTypeHasher;
+
+    class GlobalFileTypeBase;
+    class FileTypeBase;
+
+    deferred class BaseEntity;
+    ---Purpose: Base class for the WOK Kernel manipulates entities
+    
+    deferred class Entity;
+    ---Purpose: Base class for the WOK Kernel manipulates entities
+    
+    pointer PEntity to Entity from WOKernel;
+    ---Purpose: used to avoid cycling handles
+    
+    class BaseEntityHasher;
+    ---Purpose: Hashes an entity    
+    
+       class Session;
+       ---Purpose: a session is the WOK process lifetime
+
+       class EntityIterator;
+
+       pointer PSession to Session from WOKernel;
+     
+       class Factory;
+       ---Purpose: a  factory  is the  development environment  for 
+       --          the team of developers.
+       --          A factory has a warehouse and a set of workshops
+    
+       class Workshop;
+       ---Purpose: a workshop is a tree of workbench
+       --          It is used to work under a particular Parcel config
+       --          for a particuliar job       
+       --          A worshop implies a root workbench in it
+
+       class Warehouse;
+       ---Purpose: a warehouse is a parcel container
+
+       class UnitTypeDescr;
+        ---Purpose: describes a unit type
+
+       class UnitTypeBase;
+
+       deferred class UnitNesting;
+       ---Purpose: Unit Nesting is a Developement unit container
+       --          Two kinds of them : Parcel and Workbench
+       
+           class Parcel;
+           ---Purpose: a parcel is the deliverable nesting for
+           --          software components (DevUnits).
+           --          It is present in the warehouse
+           
+           class Workbench;
+           ---Purpose: a workbench is the developement environment for
+           --          a developper.
+           --          It contains DevUnits.
+           --          It is contained by a workshop
+
+       class Locator;
+    
+       class DevUnit;
+       ---Purpose: a development unit is the smallest entity
+       --          manipulated by the developper
+       --          there is various kind of DevUnits for different purposes
+
+
+       class UnitGraph;
+
+       class File;
+       ---Purpose: a DevUnit is a set of Files
+
+       class FileLocatorHasher;
+       
+    private class ImplDepIterator;
+    ---Purpose: provides an algorithm for implementations dependancies search
+
+    private class ClientIterator;
+    ---Purpose: provides an algorithm for clients search
+       
+    private class HAsciiStringHasher;
+       
+-- INSTANTIATIONS
+
+    class SequenceOfUnitTypeDescr
+       instantiates Sequence   from TCollection  ( UnitTypeDescr         from WOKernel);
+
+    class SequenceOfStationID
+       instantiates Sequence  from TCollection  ( StationID             from WOKernel ); 
+    class HSequenceOfStationID
+       instantiates HSequence from TCollection  ( StationID             from WOKernel,  
+                                                  SequenceOfStationID   from WOKernel); 
+
+    class SequenceOfDBMSID
+       instantiates Sequence  from TCollection  ( DBMSID                from WOKernel );
+    class HSequenceOfDBMSID
+       instantiates HSequence from TCollection  ( DBMSID                from WOKernel,  
+                                                  SequenceOfDBMSID      from WOKernel); 
+
+    class DataMapOfHAsciiStringOfFactory
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   Factory           from WOKernel,  
+                                                  HAsciiStringHasher    from WOKTools);
+    class DataMapOfHAsciiStringOfWarehouse
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   Warehouse         from WOKernel,  
+                                                  HAsciiStringHasher    from WOKTools);
+    class DataMapOfHAsciiStringOfWorkshop
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   Workshop          from WOKernel,  
+                                                  HAsciiStringHasher    from WOKTools);
+    class DataMapOfHAsciiStringOfParcel
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   Parcel            from WOKernel,  
+                                                  HAsciiStringHasher    from WOKTools);
+    class DataMapOfHAsciiStringOfWorkbench
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   Workbench         from WOKernel,  
+                                                  HAsciiStringHasher    from WOKTools);
+    class DataMapOfHAsciiStringOfDevUnit
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   DevUnit           from WOKernel,  
+                                                  HAsciiStringHasher    from WOKTools);
+    class DataMapOfHAsciiStringOfFile
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   File             from WOKernel, 
+                                                  HAsciiStringHasher    from WOKTools);
+    class DataMapOfFileType    
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   FileType         from WOKernel, 
+                                                  HAsciiStringHasher    from WOKTools);
+                                                  
+    class DataMapOfFileTypeBase    
+       instantiates   DataMap from WOKTools     ( HAsciiString          from TCollection,   FileTypeBase     from WOKernel, 
+                                                  HAsciiStringHasher    from WOKTools);
+                                                  
+    alias FileTypeIterator is DataMapIteratorOfDataMapOfFileType  from WOKernel;
+                                                  
+    class SequenceOfSession
+       instantiates  Sequence from TCollection  ( Session                   from WOKernel);
+
+    class SequenceOfFile       
+       instantiates Sequence  from TCollection  ( File                  from WOKernel); 
+    class HSequenceOfFile       
+       instantiates HSequence from TCollection  ( File                  from WOKernel, 
+                                                  SequenceOfFile        from WOKernel); 
+
+    private class Array1OfHSequenceOfHAsciiString
+       instantiates    Array1 from TCollection  ( HSequenceOfHAsciiString from TColStd );
+       
+    private class SequenceOfFileType
+       instantiates Sequence  from TCollection  ( FileType              from WOKernel );
+       
+    private class SortedImpldepFromIterator 
+       instantiates SortedStrgCmptsFromIterator from GraphTools (UnitGraph          from WOKernel,
+                                                                  HAsciiString       from TCollection,
+                                                                 HAsciiStringHasher from WOKernel,
+                                                                 ImplDepIterator    from WOKernel);
+    private class SortedClientsFromIterator 
+       instantiates SortedStrgCmptsFromIterator from GraphTools (UnitGraph          from WOKernel,
+                                                                  HAsciiString       from TCollection,
+                                                                 HAsciiStringHasher from WOKernel,
+                                                                 ClientIterator     from WOKernel);
+       
+end WOKernel;
diff --git a/src/WOKernel/WOKernel_BaseEntity.cdl b/src/WOKernel/WOKernel_BaseEntity.cdl
new file mode 100755 (executable)
index 0000000..cb055f7
--- /dev/null
@@ -0,0 +1,69 @@
+-- File:       WOKernel_BaseEntity.cdl
+-- Created:    Tue Aug  8 16:39:36 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class BaseEntity from WOKernel 
+inherits TShared from MMgt
+       ---Purpose: Common WOKernel Base class
+
+uses
+    HAsciiString        from TCollection,
+    PEntity             from WOKernel,
+    Entity              from WOKernel,
+    PSession            from WOKernel,
+    Session             from WOKernel
+
+raises ProgramError from Standard
+
+is
+    Initialize(aname    : HAsciiString from TCollection; anesting : Entity from WOKernel)
+    ---Purpose: Initialize a WOKernel BaseEntity
+    raises ProgramError from Standard;
+
+    SetName(me : mutable; aname : HAsciiString from TCollection) is static; 
+    ---Purpose: change name of Entity    
+    Name(me) 
+    ---Purpose: get Name of Entity    
+    ---C++: inline
+    ---C++: return const &
+       returns HAsciiString from TCollection is static;
+
+    UserPathName(me) returns HAsciiString from TCollection is static;
+    ---Warning: phase out method
+    ---C++: return const &
+    ---C++: inline
+
+    FullName(me) returns HAsciiString from TCollection is static;
+    ---C++: return const &
+    ---C++: inline
+
+    SetFullName(me:mutable; afullname : HAsciiString from TCollection);
+
+    GetUniqueName(me) 
+       returns HAsciiString from TCollection
+       is deferred;
+
+    SetNesting(me : mutable; anesting : Entity from WOKernel);
+    ---Purpose: change Nesting Entity of current Entity    
+    Nesting(me) 
+    ---Purpose: get Name of nesting Entity
+    ---C++: return const &
+    ---C++: inline
+               returns HAsciiString from TCollection;
+   
+    SetSession(me:mutable; asession : Session from WOKernel);
+    ---Purpose: change session Of Entity    
+    Session(me)
+    ---Purpose: get pointer to current Session    
+    ---C++: inline
+       returns Session from WOKernel;
+
+fields
+    myname          : HAsciiString from TCollection;
+    myfullname      : HAsciiString from TCollection is protected;
+    mynestingentity : HAsciiString from TCollection;
+    mysession       : PSession     from WOKernel;
+end BaseEntity;
diff --git a/src/WOKernel/WOKernel_BaseEntity.cxx b/src/WOKernel/WOKernel_BaseEntity.cxx
new file mode 100755 (executable)
index 0000000..7194cd6
--- /dev/null
@@ -0,0 +1,62 @@
+// File:       WOKernel_BaseEntity.cxx
+// Created:    Tue Aug  8 16:44:52 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKernel_BaseEntity.ixx>
+
+//=======================================================================
+//function : WOKernel_BaseEntity
+//purpose  : WOKernel BaseEntity initializer
+//=======================================================================
+WOKernel_BaseEntity::WOKernel_BaseEntity(const Handle(TCollection_HAsciiString)& aname, const Handle(WOKernel_Entity)& anesting)
+{
+  myname = aname;
+  if(anesting.IsNull() == Standard_False)
+    {
+      mysession = anesting->Session().operator->();
+      mynestingentity = anesting->FullName();
+    }
+  else
+    {
+      mysession = Handle(WOKernel_Session)().operator->();
+    }
+}
+
+
+//=======================================================================
+//function : SetName
+//purpose  : Sets the name of an entity
+//=======================================================================
+void WOKernel_BaseEntity::SetName(const Handle(TCollection_HAsciiString)& aname)
+{
+  myname = aname;
+}
+
+//=======================================================================
+//function : SetSession
+//purpose  : Set the session of Entity
+//=======================================================================
+void WOKernel_BaseEntity::SetSession(const Handle(WOKernel_Session)& asession)
+{
+  mysession = asession.operator->();
+}
+
+//=======================================================================
+//function : SetSession
+//purpose  : Set the session of Entity
+//=======================================================================
+void WOKernel_BaseEntity::SetNesting(const Handle(WOKernel_Entity)& anesting)
+{
+  mynestingentity = anesting->FullName();
+}
+
+//=======================================================================
+//function : SetFullName
+//purpose  : 
+//=======================================================================
+void WOKernel_BaseEntity::SetFullName(const Handle(TCollection_HAsciiString)& aname)
+{
+  myfullname = aname;
+}
diff --git a/src/WOKernel/WOKernel_BaseEntity.lxx b/src/WOKernel/WOKernel_BaseEntity.lxx
new file mode 100755 (executable)
index 0000000..ccc131c
--- /dev/null
@@ -0,0 +1,54 @@
+// File:       WOKernel_BaseEntity.lxx
+// Created:    Tue Aug  8 16:43:53 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Name
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_BaseEntity::Name() const 
+{
+  return myname;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : FullName
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_BaseEntity::FullName() const 
+{
+  return myfullname;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : UserPathName
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_BaseEntity::UserPathName() const 
+{
+  return myfullname;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Nesting
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_BaseEntity::Nesting() const 
+{
+  return mynestingentity;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Session
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_Session) WOKernel_BaseEntity::Session() const 
+{
+  return mysession;
+}
diff --git a/src/WOKernel/WOKernel_BaseEntityHasher.cdl b/src/WOKernel/WOKernel_BaseEntityHasher.cdl
new file mode 100755 (executable)
index 0000000..4b2fd0e
--- /dev/null
@@ -0,0 +1,22 @@
+-- File:       WOKernel_EntityHasher.cdl
+-- Created:    Thu Jun 29 16:43:34 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class BaseEntityHasher from WOKernel 
+
+       ---Purpose: 
+
+uses
+    BaseEntity from WOKernel
+is
+
+    HashCode(myclass; akey : BaseEntity from WOKernel)
+       returns Integer from Standard;
+       
+    IsEqual(myclass; akey1, akey2: BaseEntity from WOKernel)
+       returns Boolean from Standard;
+
+end BaseEntityHasher;
diff --git a/src/WOKernel/WOKernel_BaseEntityHasher.cxx b/src/WOKernel/WOKernel_BaseEntityHasher.cxx
new file mode 100755 (executable)
index 0000000..a5bdb0c
--- /dev/null
@@ -0,0 +1,23 @@
+// File:       WOKernel_EntityHasher.cxx
+// Created:    Thu Jun 29 17:10:20 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKernel_BaseEntityHasher.ixx>
+
+#include <WOKTools_HAsciiStringHasher.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+Standard_Integer WOKernel_BaseEntityHasher::HashCode(const Handle(WOKernel_BaseEntity)& akey)
+{
+  return WOKTools_HAsciiStringHasher::HashCode(akey->FullName());
+}
+
+Standard_Boolean WOKernel_BaseEntityHasher::IsEqual(const Handle(WOKernel_BaseEntity)& akey1, const Handle(WOKernel_BaseEntity)& akey2)
+{
+  if (strcmp(akey1->FullName()->ToCString(), akey2->FullName()->ToCString()) == 0) return(Standard_True);
+  else                                                                             return(Standard_False);
+}
+
diff --git a/src/WOKernel/WOKernel_BasicUnitTypes.hxx b/src/WOKernel/WOKernel_BasicUnitTypes.hxx
new file mode 100755 (executable)
index 0000000..8a9d874
--- /dev/null
@@ -0,0 +1,36 @@
+// File:       WOKernel_BasicUnitTypes.hxx
+// Created:    Tue Jun 10 15:48:12 1997
+// Author:     Jean GAUTIER
+//             <jga@hourax.paris1.matra-dtv.fr>
+
+
+#ifndef WOKernel_BasicUnitTypes_HeaderFile
+#define WOKernel_BasicUnitTypes_HeaderFile
+
+
+#define WOKernel_IsPackage(aunit)       (aunit->TypeCode() == 'p')
+#define WOKernel_IsSchema(aunit)        (aunit->TypeCode() == 's')
+#define WOKernel_IsInterface(aunit)     (aunit->TypeCode() == 'i')
+#define WOKernel_IsClient(aunit)        (aunit->TypeCode() == 'C')
+#define WOKernel_IsEngine(aunit)        (aunit->TypeCode() == 'e')
+#define WOKernel_IsExecutable(aunit)    (aunit->TypeCode() == 'x')
+#define WOKernel_IsNocdlpack(aunit)     (aunit->TypeCode() == 'n')
+#define WOKernel_IsToolkit(aunit)       (aunit->TypeCode() == 't')
+#define WOKernel_IsResource(aunit)      (aunit->TypeCode() == 'r')
+#define WOKernel_IsDocumentation(aunit) (aunit->TypeCode() == 'O')
+#define WOKernel_IsCCL(aunit)           (aunit->TypeCode() == 'c')
+#define WOKernel_IsFrontal(aunit)       (aunit->TypeCode() == 'f')
+#define WOKernel_IsDelivery(aunit)      (aunit->TypeCode() == 'd')
+#define WOKernel_IsIDL(aunit)           (aunit->TypeCode() == 'I')
+#define WOKernel_IsServer(aunit)        (aunit->TypeCode() == 'S')
+
+
+#define WOKernel_IsCDLUnit(aunit) ((aunit->TypeCode() == 'p') || \
+                                  (aunit->TypeCode() == 's') || \
+                                  (aunit->TypeCode() == 'i') || \
+                                  (aunit->TypeCode() == 'C') || \
+                                  (aunit->TypeCode() == 'e') || \
+                                  (aunit->TypeCode() == 'x') || \
+                                  (aunit->TypeCode() == 'S') )
+
+#endif
diff --git a/src/WOKernel/WOKernel_ClientIterator.cdl b/src/WOKernel/WOKernel_ClientIterator.cdl
new file mode 100755 (executable)
index 0000000..adb6a40
--- /dev/null
@@ -0,0 +1,45 @@
+-- File:       WOKernel_ClientIterator.cdl
+-- Created:    Thu Feb  6 16:00:32 1997
+-- Author:     Prestataire Pascal BABIN
+--             <pba@voilax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1997
+
+private class ClientIterator from WOKernel
+
+uses
+
+    HSequenceOfHAsciiString      from TColStd,
+    HAsciiString                 from TCollection,
+    UnitGraph                    from WOKernel
+    
+raises
+    NoMoreObject from Standard,
+    NoSuchObject from Standard
+is
+
+    Create (aClientGraph : UnitGraph from WOKernel; anUd : HAsciiString from TCollection) 
+       returns ClientIterator from WOKernel;
+
+    More (me) returns Boolean;
+       ---Purpose: Returns TRUE if there are other uds.
+
+    Next(me : in out)
+       --- Purpose : Set the iterator to the next ud.
+    raises NoMoreObject from Standard;
+
+    Value(me : out) returns HAsciiString from TCollection
+       --- Purpose: Returns the ud value for the current position
+       --           of the iterator.
+    raises NoSuchObject from Standard;
+
+    GetClients(me : in out);
+    
+fields
+    
+    myClientGraph  : UnitGraph                    from WOKernel;
+    myMore         : Boolean                      from Standard;
+    myCurrentUd    : HAsciiString                 from TCollection; 
+    myClients      : HSequenceOfHAsciiString      from TColStd;
+    myIndex        : Integer                      from Standard;
+    
+end ClientIterator;
diff --git a/src/WOKernel/WOKernel_ClientIterator.cxx b/src/WOKernel/WOKernel_ClientIterator.cxx
new file mode 100755 (executable)
index 0000000..5bdf97e
--- /dev/null
@@ -0,0 +1,79 @@
+// File:       WOKernel_ClientIterator.cxx
+// Created:    Thu Feb  6 16:28:45 1997
+// Author:     Prestataire Pascal BABIN
+//             <pba@voilax.paris1.matra-dtv.fr>
+
+#include <Standard_NoMoreObject.hxx>
+#include <Standard_NoSuchObject.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <WOKernel_UnitGraph.hxx>
+#include <WOKernel_ClientIterator.ixx>
+
+
+//=======================================================================
+//function : WOKernel_ClientIterator
+//purpose  : 
+//=======================================================================
+
+WOKernel_ClientIterator::WOKernel_ClientIterator (const Handle(WOKernel_UnitGraph)& aClientGraph,
+                                                 const Handle(TCollection_HAsciiString)& anUd)
+{
+  myClientGraph  = aClientGraph;
+  myCurrentUd    = anUd;
+  myMore         = Standard_True;
+  myIndex        = 0;
+  GetClients();
+}
+
+//=======================================================================
+//function : GetClients
+//purpose  : 
+//=======================================================================
+void WOKernel_ClientIterator::GetClients()
+{
+  myClients = myClientGraph->Suppliers(myCurrentUd);
+
+  if(!myClients->Length()) myMore = Standard_False;
+  else myIndex = myClients->Length();  
+}
+
+//=======================================================================
+//function : More
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKernel_ClientIterator::More () const 
+{
+  return myMore;
+}
+
+
+//=======================================================================
+//function : Next
+//purpose  : 
+//=======================================================================
+
+void WOKernel_ClientIterator::Next ()  
+{
+  Handle(TCollection_HAsciiString) aClient = myClients->Value(myIndex);
+  myIndex--;
+
+  if (myIndex == 0) myMore = Standard_False;
+
+}
+
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) WOKernel_ClientIterator::Value() 
+{  
+  return myClients->Value(myIndex);
+}
+
+
+
diff --git a/src/WOKernel/WOKernel_DBMSystem.cdl b/src/WOKernel/WOKernel_DBMSystem.cdl
new file mode 100755 (executable)
index 0000000..36a1e2c
--- /dev/null
@@ -0,0 +1,34 @@
+-- File:       WOKernel_DBMSystem.cdl
+-- Created:    Fri Jul 28 16:36:25 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class DBMSystem from WOKernel 
+
+       ---Purpose: 
+
+uses
+    DBMSID            from WOKernel,
+    HSequenceOfDBMSID from WOKernel,
+    HAsciiString       from TCollection
+raises
+    ProgramError     from Standard
+is
+
+    GetID(myclass; astring : HAsciiString from TCollection) 
+       returns DBMSID      from WOKernel
+       raises ProgramError from Standard;
+
+    IsNameKnown(myclass; astring : HAsciiString from TCollection) 
+       returns Boolean from Standard;
+
+    GetName(myclass; anid : DBMSID from WOKernel)
+               returns HAsciiString from TCollection;
+
+    GetHSeqOfDBMS(myclass; astr : HAsciiString from TCollection)
+       returns HSequenceOfDBMSID from WOKernel
+       raises  ProgramError from Standard;
+
+end DBMSystem;
diff --git a/src/WOKernel/WOKernel_DBMSystem.cxx b/src/WOKernel/WOKernel_DBMSystem.cxx
new file mode 100755 (executable)
index 0000000..7ba3cb7
--- /dev/null
@@ -0,0 +1,90 @@
+// File:       WOKernel_DBMSystem.cxx
+// Created:    Fri Jul 28 17:48:03 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKernel_DBMSystem.ixx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <TCollection_AsciiString.hxx>
+
+//=======================================================================
+//function : GetID
+//purpose  : 
+//=======================================================================
+WOKernel_DBMSID WOKernel_DBMSystem::GetID(const Handle(TCollection_HAsciiString)& astring)
+{
+  if( !strcmp( astring->ToCString(), "DFLT"  ) )  return WOKernel_DFLT;
+  if( !strcmp( astring->ToCString(), "OBJY"  ) )  return WOKernel_OBJY;
+  if( !strcmp( astring->ToCString(), "OBJS"  ) )  return WOKernel_OBJS;
+
+  ErrorMsg << "WOKernel_DBMSystem::GetID" << "DBMSystem " << astring << " is unknown for WOK" << endm;
+  Standard_ProgramError::Raise("WOKernel_DBMSystem::GetID");
+  return WOKernel_UnknownDBMS;
+}
+
+//=======================================================================
+//function : IsNameKnown
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_DBMSystem::IsNameKnown(const Handle(TCollection_HAsciiString)& astring)
+{
+  if( !strcmp( astring->ToCString(), "DFLT"  ) )  return Standard_True;
+  if( !strcmp( astring->ToCString(), "OBJY"  ) )  return Standard_True;
+  if( !strcmp( astring->ToCString(), "OBJS"  ) )  return Standard_True;
+  return Standard_False;
+}
+
+//=======================================================================
+//function : GetName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_DBMSystem::GetName(const WOKernel_DBMSID anid)
+{
+  static Handle(TCollection_HAsciiString) SDFLT    = new TCollection_HAsciiString("DFLT");
+  static Handle(TCollection_HAsciiString) SOBJY    = new TCollection_HAsciiString("OBJY");
+  static Handle(TCollection_HAsciiString) SOBJS    = new TCollection_HAsciiString("OBJS");
+  static Handle(TCollection_HAsciiString) SUNKNOWN = new TCollection_HAsciiString("UnknownDBMS");
+
+  switch(anid)
+    {
+    case WOKernel_DFLT:
+      return SDFLT;
+    case WOKernel_OBJY:
+      return SOBJY;
+    case WOKernel_OBJS:
+      return SOBJS;
+    default:
+      break;
+    }
+  return SUNKNOWN;
+}
+
+
+//=======================================================================
+//function : GetHSeqOfDBMS
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_HSequenceOfDBMSID) WOKernel_DBMSystem::GetHSeqOfDBMS(const Handle(TCollection_HAsciiString)& astr)
+{
+  Standard_Integer i = 2;
+  Handle(TCollection_HAsciiString) thestr;
+  Handle(WOKernel_HSequenceOfDBMSID) aseq = new WOKernel_HSequenceOfDBMSID;
+  
+  if(astr.IsNull())   return aseq;
+  if(astr->IsEmpty()) return aseq;
+
+  thestr = astr->Token();
+
+  while(thestr->IsEmpty() == Standard_False)
+    {
+      if(IsNameKnown(thestr))
+       {
+         aseq->Append(WOKernel_DBMSystem::GetID(thestr));
+       }
+      thestr = astr->Token(" \t", i++);
+    }
+  return aseq;
+}
diff --git a/src/WOKernel/WOKernel_DevUnit.cdl b/src/WOKernel/WOKernel_DevUnit.cdl
new file mode 100755 (executable)
index 0000000..3a7b2c4
--- /dev/null
@@ -0,0 +1,130 @@
+-- File:       WOKernel_DevUnit.cdl
+-- Created:    Fri Jun 23 17:53:27 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class DevUnit from WOKernel 
+inherits Entity from WOKernel
+
+       ---Purpose: 
+
+uses
+    HSequenceOfHAsciiString    from TColStd,
+    HAsciiString               from TCollection,
+    File                       from WOKernel,
+    FileType                   from WOKernel,
+    Locator                    from WOKernel,
+    UnitNesting                from WOKernel,
+    UnitTypeDescr              from WOKernel,
+    HSequenceOfFile            from WOKernel,
+    UnitGraph                  from WOKernel,
+    Locator                    from WOKernel,
+    Path                       from WOKUtils,
+    HSequenceOfParamItem       from WOKUtils
+    
+raises
+    ProgramError from Standard
+is
+    Create(atype : UnitTypeDescr from WOKernel; 
+          aname : HAsciiString from TCollection; 
+       anesting : UnitNesting from WOKernel)
+       returns mutable DevUnit from WOKernel; 
+    
+    GetParameters(me:mutable)
+    is redefined protected;
+
+    EntityCode(me) returns HAsciiString from TCollection is redefined;
+    TypeCode(me) returns Character from Standard;
+    Type(me) 
+    ---C++: return const &
+       returns HAsciiString from TCollection;
+    
+    
+    BuildParameters(me: mutable; someparams : HSequenceOfParamItem from WOKUtils; usedefaults : Boolean from Standard)
+    ---Purpose: constructs Sequence of Parameters Needed by Entity
+    --          to be built.
+    --          Checks their consistancy
+       returns HSequenceOfParamItem from WOKUtils is redefined;
+
+    Build(me: mutable; someparams : HSequenceOfParamItem from WOKUtils)
+    ---Purpose: Creates On disk the Unit
+    --          it must neither be opened or existing    
+    --          Parameters must all be present in someparams
+       raises ProgramError from Standard is redefined;  
+
+    Destroy(me: mutable) is redefined;
+    ---Purpose: Destroys Unit on Disk
+    --          it must not be opened    
+
+    Open(me: mutable)  
+       raises ProgramError from Standard is redefined;
+       
+    Close(me: mutable) is redefined;
+
+    --- Gestion de la liste des fichiers de l'ud
+
+    AddFile(me:mutable;    afile : File from WOKernel);
+    RemoveFile(me:mutable; afile : File from WOKernel);
+
+    ReadSingleFileList(me; afile : File from WOKernel)
+       returns HSequenceOfHAsciiString from TColStd;
+    
+    WriteSingleFileList(me; afile : File from WOKernel; files : HSequenceOfFile from WOKernel);
+
+    ReadFileList(me:mutable; alocator : Locator from WOKernel);
+
+    DumpFileList(me; alocator : Locator from WOKernel);
+    ---Purpose: Updates FileList files    
+
+    SearchInFileList(me:mutable; alocator : Locator from WOKernel; aname : HAsciiString from TCollection)
+       returns Boolean from Standard;
+
+    NestedFileName(me:mutable; atype, aname : HAsciiString from TCollection)
+       returns HAsciiString from TCollection;
+
+    SetFileList(me:mutable; aseq : HSequenceOfHAsciiString from TColStd);
+
+    FileList(me) 
+               returns HSequenceOfHAsciiString from TColStd
+       is static;
+    --- Gestion des dependences de l'ud
+    --    
+    ImplDepFile(me; alocator : Locator from WOKernel;
+                   aname    : HAsciiString from TCollection)
+               returns File from WOKernel;
+    
+    ReadImplDepFile(me; afile    : Path from WOKUtils; 
+                       alocator : Locator from WOKernel;
+                       aflag    : Boolean from Standard = Standard_False)
+       returns HSequenceOfHAsciiString from TColStd;
+       
+    ImplementationDepList(me:mutable; aunitgraph : UnitGraph from WOKernel)
+       returns HSequenceOfHAsciiString from TColStd
+       is virtual;
+
+    ImplementationDepList(me:mutable; apart : HAsciiString from TCollection; aunitgraph : UnitGraph from WOKernel)
+       returns HSequenceOfHAsciiString from TColStd;
+
+    ImplementationDep(myclass; aunitgraph : UnitGraph from WOKernel; aname : HAsciiString from TCollection;
+                                                                    alist : HSequenceOfHAsciiString from TColStd)
+       returns HSequenceOfHAsciiString from TColStd;
+
+    ImplementationDep(me:mutable; aunitgraph : UnitGraph from WOKernel)
+       returns HSequenceOfHAsciiString from TColStd
+       is virtual;
+
+    ImplementationDep(me:mutable; apart : HAsciiString from TCollection; aunitgraph : UnitGraph from WOKernel)
+       returns HSequenceOfHAsciiString from TColStd;
+
+    ImplClients(me:mutable; aclientgraph : UnitGraph from WOKernel)
+       returns HSequenceOfHAsciiString from TColStd;
+       
+fields
+
+    mytype     : UnitTypeDescr           from WOKernel;
+    myfiles    : HSequenceOfHAsciiString from TColStd;
+    
+end DevUnit;
diff --git a/src/WOKernel/WOKernel_DevUnit.cxx b/src/WOKernel/WOKernel_DevUnit.cxx
new file mode 100755 (executable)
index 0000000..110c137
--- /dev/null
@@ -0,0 +1,1145 @@
+#include <strstream.h>
+
+#include <fstream.h>
+
+#include <Standard_ProgramError.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+#include <WOKTools_MapOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+#include <WOKTools_IndexedDataMapOfHAsciiString.hxx>
+
+
+#include <WOKUtils_ParamItem.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_HSequenceOfParamItem.hxx>
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_AdmFile.hxx>
+
+
+#include <WOKernel_Session.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_Workbench.hxx>
+#include <WOKernel_DataMapIteratorOfDataMapOfFileType.hxx>
+#include <WOKernel_FileType.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_File.hxx>
+#include <WOKernel_HSequenceOfFile.hxx>
+#include <WOKernel_Locator.hxx>
+#include <WOKernel_UnitGraph.hxx>
+#include <WOKernel_SortedImpldepFromIterator.hxx>
+#include <WOKernel_SortedClientsFromIterator.hxx>
+#include <WOKernel_DevUnit.ixx>
+
+#define READBUF_SIZE 1024
+
+#ifndef WOK_DEPCOMPAT
+#define WOK_DEPCOMPAT 1
+#endif
+
+//=======================================================================
+//function : WOKernel_DevUnit
+//purpose  : 
+//=======================================================================
+WOKernel_DevUnit::WOKernel_DevUnit(const Handle(WOKernel_UnitTypeDescr)& atype,
+                                  const Handle(TCollection_HAsciiString)& aname, 
+                                  const Handle(WOKernel_UnitNesting)& anesting) 
+  : mytype(atype), WOKernel_Entity(aname, anesting)
+{
+}
+
+//=======================================================================
+//function : GetParameters
+//purpose  :  
+//=======================================================================
+void WOKernel_DevUnit::GetParameters()
+{
+  Standard_Integer i;
+  Handle(TColStd_HSequenceOfAsciiString) aseq;
+  Handle(TColStd_HSequenceOfAsciiString) subclasses = new TColStd_HSequenceOfAsciiString;
+  Handle(TColStd_HSequenceOfAsciiString) dirs       = new TColStd_HSequenceOfAsciiString;
+  Handle(TCollection_HAsciiString) astr;
+  Handle(TCollection_HAsciiString) libdir;
+  Handle(WOKernel_Entity) wbnesting,isletnesting,udfromdad;
+  
+  if(!Nesting().IsNull())
+    {
+      // Entites quelconques
+      
+      wbnesting = Session()->GetEntity(Nesting());
+      if (!wbnesting->IsKind(STANDARD_TYPE(WOKernel_Workbench))) 
+       { // unit in parcel
+         WOKernel_Entity::GetParameters();
+       }
+      else 
+       { // unit in workbench : identical subclasses
+         aseq = wbnesting->Params().SubClasses();
+         if(!aseq.IsNull())
+           {
+             for(i=1; i<=aseq->Length(); i++)
+               {
+                 subclasses->Append(aseq->Value(i));
+               }
+           }
+         
+         subclasses->Append(Name()->ToCString());
+         
+         //ChangeParams().SetSubClasses(subclasses);
+         // unit in workbench : Search Directories for src are inserted
+         isletnesting = Session()->GetEntity(wbnesting->Nesting());
+         if (!isletnesting.IsNull()) 
+           {
+             aseq =  isletnesting->Params().SearchDirectories();
+             if(!aseq.IsNull())
+               {
+                 for(i=1; i<=aseq->Length(); i++)
+                   {
+                     dirs->Append(aseq->Value(i));
+                   }
+               }
+             
+             ChangeParams().SetSubClasses(subclasses);
+             ChangeParams().SetSearchDirectories(dirs);
+             
+             // Evaluation adm for wb ancestors and insert sources dirs for DevUnit
+             Handle(TColStd_HSequenceOfHAsciiString) ances = Handle(WOKernel_Workbench)::DownCast(wbnesting)->Ancestors();
+
+             for (Standard_Integer i= ances->Length(); i > 1 ; i--) 
+               {
+                 Handle(WOKernel_Workbench) wb = Session()->GetWorkbench(ances->Value(i));
+                 
+                 
+                 if (!wb.IsNull()) 
+                   {
+                     astr = wb->EvalParameter("Adm", Standard_False);
+                     
+                     if(!astr.IsNull()) 
+                       {
+                         dirs->Prepend(astr->ToCString());
+                         //TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+                         //lastsub.AssignCat("@");
+                         //lastsub.AssignCat(astr->String());
+                       }
+                     
+                     Handle(WOKernel_DevUnit) udfromdad = Session()->GetDevUnit(wb->NestedUniqueName(Name()));
+                     if (!udfromdad.IsNull()) 
+                       {
+                         udfromdad->Open();
+                         Handle(WOKernel_FileType)        atype = udfromdad->FileTypeBase()->Type("source");
+                         Handle(TCollection_HAsciiString) apath = atype->ComputePath(udfromdad->Params(), new TCollection_HAsciiString("."));
+                         dirs->Prepend(apath->ToCString());
+                         TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+                         if(lastsub.Search("@") > 0 )
+                           {
+                             // grandfathers
+                             subclasses->Append(Name()->String());
+                             TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+                             lastsub.AssignCat("@");
+                             lastsub.AssignCat(apath->String());
+                           }
+                         else
+                           {
+                             lastsub.AssignCat("@");
+                             lastsub.AssignCat(apath->String());
+                           }
+                       }
+                   }
+               }
+             
+             // dans le WB courant
+             astr = wbnesting->EvalParameter("Adm", Standard_False);
+             if(!astr.IsNull()) 
+               {
+                 dirs->Prepend(astr->ToCString());
+               }
+             //Handle(WOKernel_FileType)        atype = FileTypeBase()->Type("source");
+             //Handle(TCollection_HAsciiString) apath = atype->ComputePath(Params(), new TCollection_HAsciiString("."));
+             //dirs->Prepend(apath->ToCString());
+
+             ChangeParams().SetSearchDirectories(dirs);
+           }
+       }
+    }
+  
+  Params().Set("%UnitType", Type()->ToCString());
+  
+}  
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : EntityCode
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_DevUnit::EntityCode() const
+{
+  static Handle(TCollection_HAsciiString) acode = new TCollection_HAsciiString("devunit");
+  return acode;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : TypeCode
+//purpose  : 
+//=======================================================================
+Standard_Character WOKernel_DevUnit::TypeCode() const
+{
+  return mytype->Key();
+}
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : TypeCode
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_DevUnit::Type() const
+{
+  return mytype->Type();
+}
+
+//=======================================================================
+//function : BuildParameters
+//purpose  : 
+//=======================================================================
+Handle(WOKUtils_HSequenceOfParamItem) WOKernel_DevUnit::BuildParameters(const Handle(WOKUtils_HSequenceOfParamItem)& someparams,
+                                                                       const Standard_Boolean usedefaults) 
+{
+  Handle(WOKernel_UnitNesting) anesting;
+  
+  anesting = Session()->GetUnitNesting(Nesting());
+
+  if(anesting.IsNull())
+    {
+      ErrorMsg << "WOKernel_DevUnit::Build" 
+              << "Nesting : " << Nesting() << " is an invalid Nesting for a DevUnit" << endm;
+      return someparams;
+    }
+
+  someparams->Append(WOKUtils_ParamItem(ParameterName("DBMSystems"), anesting->EvalParameter("DBMSystems")));
+  someparams->Append(WOKUtils_ParamItem(ParameterName("Stations"),   anesting->EvalParameter("Stations")));
+
+  WOKernel_Entity::BuildParameters(someparams, usedefaults);
+  return someparams;
+}
+
+//=======================================================================
+//function : Build
+//purpose  :
+//=======================================================================
+void WOKernel_DevUnit::Build(const Handle(WOKUtils_HSequenceOfParamItem)& someparams)
+{
+  WOKernel_Entity::Build(someparams);
+  return;
+}
+
+//=======================================================================
+//function : Destroy
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::Destroy()
+{
+  if(myfiles.IsNull())
+    {
+      ReadFileList(Handle(WOKernel_Locator)());
+    }
+
+  Standard_Integer i;
+  Handle(TCollection_HAsciiString) aname, atype;
+  Handle(WOKernel_File) afile;
+
+  for(i=1; i<=myfiles->Length(); i++)
+    {
+      aname = myfiles->Value(i)->Token(":", 3);
+      atype = myfiles->Value(i)->Token(":", 2);
+      
+      afile = new WOKernel_File(aname, this, GetFileType(atype));
+
+      afile->GetPath();
+
+      if(afile->Path()->Exists())
+       {
+         WOK_TRACE {
+           VerboseMsg("WOK_DESTROY") << "WOKernel_DevUnit::Destroy" 
+                                     << "Removing file : " << afile->Path()->Name() << endm;
+         }
+         afile->Path()->RemoveFile();
+       }
+    }
+
+  WOKernel_Entity::Destroy();
+}
+
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::Open()
+{
+  if(IsOpened()) return;
+  {
+    Handle(WOKernel_Workbench)            abench;
+    Handle(WOKernel_DevUnit)              aunit;
+    Handle(WOKernel_BaseEntity)           anentity;
+    Handle(WOKernel_UnitNesting)     anesting = Session()->GetUnitNesting(Nesting());
+    Handle(TCollection_HAsciiString) astr;
+    
+    GetParams();
+
+    SetFileTypeBase(Session()->GetFileTypeBase(this));
+
+    abench = Session()->GetWorkbench(Nesting());
+
+    if(!abench.IsNull())
+      {
+       Handle(WOKernel_Workbench) afather = Session()->GetWorkbench(abench->Father());
+
+       // le nesting est un WB donc tenter d'ouvrir l'ud ds les wbs peres d'abord
+       if(afather.IsNull() == Standard_False)
+         {
+           // le WB n'est pas une racine
+           astr = afather->NestedUniqueName(Name());
+
+           anentity = Session()->GetEntity(afather->NestedUniqueName(Name()));
+
+           if(anentity.IsNull() == Standard_False)
+             {
+               // l'ud est presente dans le pere
+
+               aunit = Handle(WOKernel_DevUnit)::DownCast(anentity);
+               
+               if(aunit.IsNull() == Standard_True)
+                 {
+                   ErrorMsg << "WOKernel_DevUnit::Open" 
+                     << "Wrong Type for Entity " 
+                       << Name() << "found in workbench " 
+                         << afather->Name() << endm;
+                   Standard_ProgramError::Raise("WOKernel_DevUnit::Open");
+                 }
+               
+               aunit->Open();
+             }
+         }
+      }
+
+    
+
+    // Clacul de quelques parametres de confort : ADM, SRC, DRV, HOME
+    
+    Handle(WOKernel_FileType)        atype;
+    Handle(TCollection_HAsciiString) apath;
+
+    atype = FileTypeBase()->Type("source");
+    
+    apath = atype->ComputePath(Params(), new TCollection_HAsciiString("."));
+
+    if(!apath.IsNull())
+      {
+       Params().Set(ParameterName("Src")->ToCString(), apath->ToCString());
+       Params().Set(ParameterName("Home")->ToCString(), apath->ToCString());
+       Params().SearchDirectories()->Prepend(apath->ToCString());
+       Params().SubClasses()->Append(Name()->String());
+       TCollection_AsciiString& lastsub =  Params().SubClasses()->ChangeValue(Params().SubClasses()->Length());
+       lastsub.AssignCat("@");
+       lastsub.AssignCat(apath->String());
+    
+      }
+    
+    atype = FileTypeBase()->Type("library");
+
+    apath = atype->ComputePath(Params(), new TCollection_HAsciiString("."));
+    
+    if(!apath.IsNull())
+      {
+       Params().Set(ParameterName("Lib")->ToCString(), apath->ToCString());
+      }
+    
+    
+    atype = FileTypeBase()->Type("admfile");
+
+    apath = atype->ComputePath(Params(), new TCollection_HAsciiString("."));
+    
+    if(!apath.IsNull())
+      {
+       Params().Set(ParameterName("Adm")->ToCString(), apath->ToCString());
+      }
+
+    SetOpened();
+  }
+}
+
+//=======================================================================
+//function : Close
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::Close()
+{
+  if(!IsOpened()) return;
+
+  myfiles.Nullify();
+  Reset();
+  SetClosed();
+}
+
+//=======================================================================
+//function : AddFile
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::AddFile(const Handle(WOKernel_File)& afile)
+{
+  FileList()->Append(afile->LocatorName());
+}
+
+//=======================================================================
+//function : RemoveFile
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::RemoveFile(const Handle(WOKernel_File)& afile)
+{
+  Standard_Integer i;
+  
+  for(i=1; i<=myfiles->Length(); i++)
+    {
+      if(afile->FullName()->IsSameString(myfiles->Value(i)))
+       {
+         myfiles->Remove(i);
+         break;
+       }
+    }
+  return;
+}
+
+//=======================================================================
+//function : ReadSingleFileList
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ReadSingleFileList(const Handle(WOKernel_File)& afile) const
+{
+  Handle(TColStd_HSequenceOfHAsciiString) afileseq = new TColStd_HSequenceOfHAsciiString;
+  Handle(WOKernel_File) thefile;
+  Handle(TCollection_HAsciiString) astr, atype;
+  Handle(WOKernel_File) infile;
+  Handle(WOKUtils_Path) apath;
+
+  if(afile.IsNull())
+    {
+      return afileseq;
+    }
+
+  afile->GetPath();
+    
+  apath = afile->Path();
+  
+  if(!apath->Exists())
+    {  
+      return afileseq;
+    }
+
+
+    {
+      char typebuf[1024];
+      char namebuf[1024];
+      ifstream astream(apath->Name()->ToCString(), ios::in);
+
+      *namebuf = *typebuf = '\0';
+
+      if(!astream)
+       {
+         ErrorMsg << "WOKernel_DevUnit::ReadSingleFileList" << "Could not open " << afile->Path()->Name() << endm;
+         Standard_ProgramError::Raise("WOKernel_DevUnit::ReadSingleFileList");
+       }
+      
+      while(astream >> setw(1024) >> typebuf >> setw(1024) >> namebuf)
+       {
+         astr  = new TCollection_HAsciiString(namebuf);
+         atype = new TCollection_HAsciiString(typebuf);
+
+         afileseq->Append(WOKernel_File::FileLocatorName(Name(), atype, astr));
+
+         *namebuf = *typebuf = '\0';
+       }
+      astream.close();
+      return afileseq;
+    }
+}
+
+
+//=======================================================================
+//function : WriteSingleFileList
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::WriteSingleFileList(const Handle(WOKernel_File)& afile, const Handle(WOKernel_HSequenceOfFile)& alist) const
+{
+  afile->GetPath();
+  ofstream astream(afile->Path()->Name()->ToCString(), ios::out);
+  
+  if(!astream)
+    {
+      ErrorMsg << "WOKernel_DevUnit::WriteSingleFileList" << "Could not open " << afile->Path()->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_DevUnit::WriteSingleFileList");
+    }
+  
+  for(Standard_Integer i=1; i<=alist->Length(); i++)
+    {
+      astream << FileTypeBase()->TypeName(alist->Value(i)->Type())->ToCString() 
+       << " "
+         << alist->Value(i)->Name()->ToCString() << endl;
+    }
+  astream.close();
+  return;
+}
+
+//=======================================================================
+//function : ReadFileList
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::ReadFileList(const Handle(WOKernel_Locator)& alocator) 
+{
+  Handle(TCollection_HAsciiString) afilelistfile, locatorname;
+  Handle(WOKernel_File)                  admfile, dbadmfile, stadmfile;
+  Handle(WOKernel_File)                    afile;
+  Handle(TColStd_HSequenceOfHAsciiString) afileseq;
+  WOKTools_MapOfHAsciiString                amap;
+  Standard_Integer i;
+
+  if(myfiles.IsNull()==Standard_False)
+    {
+      myfiles->Clear();
+    }
+  else
+    {
+      myfiles = new TColStd_HSequenceOfHAsciiString;
+    }
+  
+  afilelistfile = new TCollection_HAsciiString(Name());
+  afilelistfile->AssignCat(Params().Eval("%FILENAME_FILELIST_EXT"));
+
+  if(alocator.IsNull())
+    admfile = new WOKernel_File(afilelistfile, this, GetFileType("admfile"));
+  else
+    admfile = alocator->Locate(Name(), GetFileType("admfile")->Name(), afilelistfile);
+
+  if(!admfile.IsNull())
+    {
+      if (!amap.Contains(admfile->LocatorName())) {
+       amap.Add(admfile->LocatorName());
+       myfiles->Append(admfile->LocatorName());
+      }
+      afileseq = ReadSingleFileList(admfile);
+      for(i=1; i<=afileseq->Length(); i++) 
+       {
+         locatorname = afileseq->Value(i);
+         if(!amap.Contains(locatorname))
+           {
+             amap.Add(locatorname);
+             myfiles->Append(locatorname);
+           }
+       }
+    }
+
+  if(alocator.IsNull())
+    dbadmfile = new WOKernel_File(afilelistfile, this, GetFileType("dbadmfile"));
+  else
+    dbadmfile = alocator->Locate(Name(), GetFileType("dbadmfile")->Name(), afilelistfile);
+
+  if(!dbadmfile.IsNull())
+    {
+      if (!amap.Contains(dbadmfile->LocatorName())) {
+       amap.Add(dbadmfile->LocatorName());
+       myfiles->Append(dbadmfile->LocatorName());
+      }
+      afileseq = ReadSingleFileList(dbadmfile);
+      for(i=1; i<=afileseq->Length(); i++) 
+       {
+         locatorname = afileseq->Value(i);
+         if(!amap.Contains(locatorname))
+           {
+             amap.Add(locatorname);
+             myfiles->Append(locatorname);
+           }
+       }
+    }
+
+  if(alocator.IsNull())
+    stadmfile = new WOKernel_File(afilelistfile, this, GetFileType("stadmfile"));
+  else
+    stadmfile = alocator->Locate(Name(), GetFileType("stadmfile")->Name(), afilelistfile);
+
+  if(!stadmfile.IsNull())
+    {
+      if (!amap.Contains(stadmfile->LocatorName())) {
+       amap.Add(stadmfile->LocatorName());
+       myfiles->Append(stadmfile->LocatorName());
+      }
+      afileseq = ReadSingleFileList(stadmfile);
+      for(i=1; i<=afileseq->Length(); i++) 
+       {
+         locatorname = afileseq->Value(i);
+         if(!amap.Contains(locatorname))
+           {
+             amap.Add(locatorname);
+             myfiles->Append(locatorname);
+           }
+       }
+    }
+  return;
+}
+
+//=======================================================================
+//function : DumpFileList
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::DumpFileList(const Handle(WOKernel_Locator)& alocator) const
+{
+  Handle(TCollection_HAsciiString) afilelistfile;
+  Handle(WOKernel_File) admfile, dbadmfile, stadmfile;
+  Handle(WOKernel_File) afile, thefile;
+
+  afilelistfile = new TCollection_HAsciiString(Name());
+  afilelistfile->AssignCat(Params().Eval("%FILENAME_FILELIST_EXT"));
+
+  admfile = new WOKernel_File(afilelistfile, this, GetFileType("admfile"));
+  admfile->GetPath();
+  ofstream admstream(admfile->Path()->Name()->ToCString());
+
+  dbadmfile = new WOKernel_File(afilelistfile, this, GetFileType("dbadmfile"));
+  dbadmfile->GetPath();
+  ofstream dbadmstream(dbadmfile->Path()->Name()->ToCString());
+
+  stadmfile = new WOKernel_File(afilelistfile, this, GetFileType("stadmfile"));
+  stadmfile->GetPath();
+  ofstream stadmstream(stadmfile->Path()->Name()->ToCString());
+
+  for(Standard_Integer i=1; i<=myfiles->Length(); i++)
+    {
+      afile = alocator->Locate(myfiles->Value(i));
+
+      if(afile.IsNull() == Standard_False)
+       {
+         if(afile->Type()->IsStationDependent())
+           {
+             stadmstream << afile->TypeName()->ToCString() << " " << afile->Name()->ToCString() << endl;
+           }
+         else if(afile->Type()->IsDBMSDependent())
+           {
+             dbadmstream << afile->TypeName()->ToCString() << " " << afile->Name()->ToCString() << endl;
+           }
+         else
+           {
+             admstream << afile->TypeName()->ToCString() << " " << afile->Name()->ToCString() << endl;
+           }
+       }
+    }
+  stadmstream.close();
+  dbadmstream.close();
+  admstream.close();
+  return;
+}
+//=======================================================================
+//function : SearchInFileList
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_DevUnit::SearchInFileList(const Handle(WOKernel_Locator)& alocator,
+                                                   const Handle(TCollection_HAsciiString)& afilename)
+{
+  Handle(TColStd_HSequenceOfHAsciiString) fileseq;
+  Standard_Boolean found = Standard_False;
+  Standard_Integer i;
+  
+  if (FileList().IsNull()) ReadFileList(alocator);
+
+  fileseq = FileList();
+  
+  for(i=1; i<=fileseq->Length() && !found; i++)
+    {
+      Handle(TCollection_HAsciiString) file     = fileseq->Value(i);
+      Handle(TCollection_HAsciiString) filename = file->Token(":",3);
+
+      if (!strcmp(filename->ToCString(),afilename->ToCString()))
+       found =Standard_True;
+    }
+
+  return found;  
+}
+
+//=======================================================================
+//function : NestedFileName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_DevUnit::NestedFileName(const Handle(TCollection_HAsciiString)& atype,
+                                                                 const Handle(TCollection_HAsciiString)& aname)  
+{
+  Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString(aname);
+  astr->AssignCat(":");
+  astr->AssignCat(atype);
+  astr->AssignCat(":");
+  astr->AssignCat(FullName());
+  return astr;
+}
+
+//=======================================================================
+//function : SetFileList
+//purpose  : 
+//=======================================================================
+void WOKernel_DevUnit::SetFileList(const Handle(TColStd_HSequenceOfHAsciiString)& aseq)
+{
+  myfiles = aseq;
+}
+
+//=======================================================================
+//function : FileList
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::FileList() const
+{
+  return myfiles;
+}
+
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : ImplDepFile
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_File) WOKernel_DevUnit::ImplDepFile(const Handle(WOKernel_Locator)& alocator,
+                                                   const Handle(TCollection_HAsciiString)& aname) const
+{
+  Handle(WOKernel_File) result;
+  Handle(TCollection_HAsciiString) impldepfilename;
+
+  static Handle(TCollection_HAsciiString)     stadmtype = new TCollection_HAsciiString("stadmfile");
+  
+  impldepfilename = new TCollection_HAsciiString(aname);
+  impldepfilename->AssignCat(".");
+  impldepfilename->AssignCat(Params().Eval("%FILENAME_IMPLDEP"));
+  
+  result = alocator->Locate(Name(), stadmtype, impldepfilename);
+
+  return result;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : ReadImplDepFile
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ReadImplDepFile(const Handle(WOKUtils_Path)& afile,
+                                                                         const Handle(WOKernel_Locator)& alocator,
+                                                                         const Standard_Boolean oldWokFile) const
+{
+  Handle(TColStd_HSequenceOfHAsciiString) result = new TColStd_HSequenceOfHAsciiString;
+  Handle(TCollection_HAsciiString)        astr;
+  Handle(WOKernel_DevUnit)                aunit;
+  ifstream astream(afile->Name()->ToCString());
+  static char                                 anamebuf[READBUF_SIZE];
+
+  *anamebuf = '\0';
+
+  astream >> setw(READBUF_SIZE) >> anamebuf;
+  
+  while (!astream.eof()) {
+    if(strcmp(anamebuf, Name()->ToCString())) {
+      astr = new TCollection_HAsciiString(anamebuf);
+      
+      aunit = alocator->LocateDevUnit(astr);
+      
+      if(aunit.IsNull()) 
+       {
+         WarningMsg << "WOKernel_DevUnit::ReadImplDepFile" 
+                    << "Wrong or not visible entry " << astr << " in implementation dep of " << Name() << endm;
+       }
+      else
+       {
+         result->Append(astr);
+       }
+    }
+    *anamebuf = '\0';
+    
+    astream >> setw(READBUF_SIZE) >> anamebuf;  
+  }
+  astream.close();
+  return result;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : ImplementationDepList
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ImplementationDepList(const Handle(WOKernel_UnitGraph)& agraph) 
+{
+  Handle(TColStd_HSequenceOfHAsciiString)     unitDep, result,NULLRESULT;
+  Handle(TCollection_HAsciiString)            impldepfilename, aname;
+  Handle(WOKernel_DevUnit)                    aunit;
+  Handle(WOKernel_File)                       impldepfile;
+  Standard_Boolean                            oldWokFile = Standard_False;
+             
+  unitDep = new TColStd_HSequenceOfHAsciiString;
+
+  if(!IsOpened()) Open();
+
+  static Handle(TCollection_HAsciiString)     stadmtype = new TCollection_HAsciiString("stadmfile");
+
+  if (agraph->Contains(Name())) 
+    {
+      return agraph->Suppliers(Name());
+    }
+  else 
+    {
+      impldepfile = ImplDepFile(agraph->Locator(), Name());
+      
+      oldWokFile = Standard_False;
+      
+      if (impldepfile.IsNull()) 
+       {  
+         Handle(TCollection_HAsciiString) impldepfilename = new TCollection_HAsciiString;
+         Handle(TCollection_HAsciiString) stadmtype = new TCollection_HAsciiString("stadmfile");
+         
+         impldepfilename->AssignCat(Name());
+         impldepfilename->AssignCat(".");
+         impldepfilename->AssignCat(Params().Eval("%FILENAME_IMPLDEP"));
+  
+         Standard_Boolean mustExist = SearchInFileList(agraph->Locator(),impldepfilename);
+         if (mustExist)
+           {
+             ErrorMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                      << "Implementation Dependences not found for " << Name() << endm;
+             ErrorMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                      << "Perhaps " << Name() << " is not compiled on this platform" << endm;
+             return NULLRESULT;
+           }
+         else
+           {
+             WarningMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                        << "Could not determine Implementation Dependences for " << Name() << endm;
+             agraph->Add(Name(), new TColStd_HSequenceOfHAsciiString);
+           }
+       }
+      else 
+       {
+         unitDep = ReadImplDepFile(impldepfile->Path(), agraph->Locator(), oldWokFile);
+         agraph->Add(Name(),unitDep);
+       }
+    }      
+  
+  static Handle(TCollection_HAsciiString) sourcetype = new TCollection_HAsciiString("source");
+  Handle(TCollection_HAsciiString) filename = new TCollection_HAsciiString(Name());
+  
+  filename->AssignCat(".");
+  filename->AssignCat(Params().Eval("%FILENAME_DYNAMICPK"));
+
+  Handle(WOKernel_File) intern = agraph->Locator()->Locate(Name(), sourcetype, filename);
+  
+  if(!intern.IsNull())
+    {
+      WOKUtils_AdmFile adm(intern->Path());
+      Handle(TColStd_HSequenceOfHAsciiString) aseq = adm.Read();
+
+      if(!aseq.IsNull())
+       {
+         Standard_Integer i;
+
+         for(i=1; i<=aseq->Length(); i++)
+           {
+             Handle(TCollection_HAsciiString) paramname = new TCollection_HAsciiString("%");
+             Handle(TCollection_HAsciiString) paramval;
+             
+             paramname->AssignCat(aseq->Value(i));
+
+             paramval = Params().Eval(paramname->ToCString());
+
+             if(paramval.IsNull())
+               {
+                 WarningMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                          << "Could not find DYNAMICPK definition for " << paramname 
+                          << " referenced in " << intern->Path()->Name() << endm;
+                 
+               }
+             else
+               {
+                 Handle(WOKernel_DevUnit) unit = agraph->Locator()->LocateDevUnit(paramval);
+                 
+                 if(unit.IsNull())
+                   {
+                     WarningMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                                << "Could not find unit " << paramval 
+                                << " referenced in " << intern->Path()->Name() << endm;
+                   }
+                 else
+                   {
+                     unitDep->Append(unit->Name()); 
+                   }
+               }
+           }
+       }
+    }
+
+  result = unitDep;
+  
+  return result;
+}
+
+//=======================================================================
+//function : ImplementationDep
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ImplementationDepList(const Handle(TCollection_HAsciiString)& aname,
+                                                                               const Handle(WOKernel_UnitGraph)& agraph) 
+{
+  Handle(TCollection_HAsciiString)            impldepfilename, filename;
+  Handle(TCollection_HAsciiString)            stadmtype = new TCollection_HAsciiString("stadmfile");
+  Handle(WOKernel_File)                       impldepfile;
+  Handle(WOKernel_DevUnit)                    aunit;
+  Handle(TColStd_HSequenceOfHAsciiString)     result,tmp = new TColStd_HSequenceOfHAsciiString;
+  Standard_Boolean                            depError = Standard_False;
+  
+  if(!agraph->Contains(aname))
+    {
+      static char                                 anamebuf[READBUF_SIZE];
+      
+      impldepfilename = Params().Eval("%FILENAME_IMPLDEP");
+      
+      if(impldepfilename.IsNull()) {
+       ErrorMsg << "WOKernel_DevUnit::ImplementationDep" << "Could not eval parameter : FILENAME_IMPLDEP" << endm;
+       return result;
+      }
+
+      anamebuf[0] = '\0';
+      
+      
+      filename = new TCollection_HAsciiString(aname);
+      filename->AssignCat(".");
+      filename->AssignCat(impldepfilename);
+      
+      impldepfile = agraph->Locator()->Locate(Name(), stadmtype, filename);
+      
+      if (impldepfile.IsNull()) 
+       {
+         Standard_Boolean mustExist = SearchInFileList(agraph->Locator(),filename);
+         if (mustExist)
+           {
+             ErrorMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                      << "Implementation Dependences not found for " << aname << endm;
+             ErrorMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                      << "Perhaps " << aname << " is not compiled on this platform" << endm;
+             return result;
+           }
+         else
+           {
+             WarningMsg << "WOKernel_DevUnit::ImplementationDepList" 
+                        << "Could not determine Implementation Dependences for " << aname << endm;
+             result = new TColStd_HSequenceOfHAsciiString;
+           }
+         
+       }
+
+      else {
+       Handle(TCollection_HAsciiString) astr;
+       ifstream astream(impldepfile->Path()->Name()->ToCString());
+       
+       *anamebuf = '\0';
+       while(astream >> setw(READBUF_SIZE) >> anamebuf)
+         {
+           if(strcmp(anamebuf, Name()->ToCString()))
+             {
+               astr = new TCollection_HAsciiString(anamebuf);
+               
+               aunit = agraph->Locator()->LocateDevUnit(astr);
+               
+               if(aunit.IsNull())
+                 {
+                   WarningMsg << "WOKernel_Executable::ImplementationDep" 
+                              << "Wrong or not visible entry " << astr << " in implementation dep of " << Name() << endm;
+                   depError = Standard_True;
+                 }
+               else
+                 {
+                   tmp->Append(astr);
+                 }
+             }
+           
+           *anamebuf = '\0';
+         }
+       if(!depError)
+         {
+           agraph->Add(aname, tmp);
+           result = tmp;
+         }
+      }
+    }
+  else
+    {
+      result = agraph->Suppliers(aname);
+    }
+  return result;
+}
+
+
+//=======================================================================
+//function : ImplementationDep
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ImplementationDep(const Handle(WOKernel_UnitGraph)& agraph,
+                                                                           const Handle(TCollection_HAsciiString)& name,
+                                                                           const Handle(TColStd_HSequenceOfHAsciiString)& alist)
+{
+  Handle(TColStd_HSequenceOfHAsciiString)  result = new TColStd_HSequenceOfHAsciiString;
+  Handle(TColStd_HSequenceOfHAsciiString)  NULLRESULT;
+  Standard_Boolean                         IsCyclic = Standard_False;
+  WOKernel_SortedImpldepFromIterator       algo;
+  Standard_Integer                         i;
+
+  try {
+
+    agraph->Add(name,alist); 
+    
+    algo.FromVertex(name);
+    algo.Perform(agraph);
+    
+    while(algo.More())
+      {      
+       if(algo.NbVertices() > 1)
+         {
+           ErrorMsg << "WOKernel_DevUnit::ImplementationDep"
+                    << "Cyclic dependency detected between: ";
+           
+           for(i=1; i<= algo.NbVertices(); i++)
+             {
+               ErrorMsg << algo.Value(i) << " ";
+             }
+           
+           ErrorMsg << endm;
+           
+           IsCyclic = Standard_True;
+         }
+       
+       else
+         result->Prepend(algo.Value(1));
+       
+       algo.Next();
+      }
+    
+    if(IsCyclic )
+      return NULLRESULT;
+    else
+      return result;
+  }
+
+  catch (Standard_Failure )  
+    { 
+      Handle(Standard_Failure) E = Standard_Failure::Caught(); 
+      strstream astream;
+      astream << E << ends;
+
+      ErrorMsg << "WOKernel_DevUnit::ImplementationDep" << "Exception was raised : " << astream.str() << endm;
+      return NULLRESULT ;
+    }
+#ifdef WNT
+      return NULLRESULT;
+#endif  // WNT
+
+}
+
+//=======================================================================
+//function : ImplementationDep
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ImplementationDep(const Handle(WOKernel_UnitGraph)& agraph) 
+{
+  Handle(TColStd_HSequenceOfHAsciiString) tmp;
+
+  tmp = ImplementationDepList(agraph);
+
+  if (tmp.IsNull()) 
+    return tmp;
+  else
+    return WOKernel_DevUnit::ImplementationDep(agraph, Name(), tmp);
+}
+
+//=======================================================================
+//function : ImplementationDep
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ImplementationDep(const Handle(TCollection_HAsciiString)& apart,
+                                                                              const Handle(WOKernel_UnitGraph)& agraph)
+{
+  Handle(TCollection_HAsciiString)        aname;
+  Handle(TColStd_HSequenceOfHAsciiString) tmp;
+
+  aname = new TCollection_HAsciiString(Name());
+  aname->AssignCat("_");
+  aname->AssignCat(apart);
+
+  tmp = ImplementationDepList(aname, agraph);
+
+  if(!tmp.IsNull())
+    {
+      return WOKernel_DevUnit::ImplementationDep(agraph, aname, tmp);
+    }
+  else return tmp;
+}
+
+
+//=======================================================================
+//function : ImplClients
+//purpose  : perform an algorithm for clients search
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_DevUnit::ImplClients(const Handle(WOKernel_UnitGraph)& aclientgraph)
+{
+  Handle(TColStd_HSequenceOfHAsciiString)  result = new TColStd_HSequenceOfHAsciiString;
+  Handle(TColStd_HSequenceOfHAsciiString)  NULLRESULT;
+  Standard_Boolean                         IsCyclic = Standard_False;
+  WOKernel_SortedClientsFromIterator       algo;
+  Standard_Integer                         i;
+
+  try {
+
+    algo.FromVertex(Name());
+    algo.Perform(aclientgraph);
+    
+    while(algo.More())
+      {      
+       if(algo.NbVertices() > 1)
+         {
+           ErrorMsg << "WOKernel_DevUnit::ImplClients"
+                    << "Cyclic dependency detected between: ";
+           
+           for(i=1; i<= algo.NbVertices(); i++)
+             {
+               ErrorMsg << algo.Value(i) << " ";
+             }
+           
+           ErrorMsg << endm;
+           
+           IsCyclic = Standard_True;
+         }
+       
+       else
+         result->Prepend(algo.Value(1));
+       
+       algo.Next();
+      }
+    
+    if(IsCyclic)
+      return NULLRESULT;
+    else
+      return result;
+  }
+
+  catch (Standard_Failure )  
+    { 
+      Handle(Standard_Failure) E = Standard_Failure::Caught(); 
+      strstream astream;
+      astream << E << ends;
+
+      ErrorMsg << "WOKernel_DevUnit::ImplClients" << "Exception was raised : " << astream.str() << endm;
+      return NULLRESULT ;
+    }
+#ifdef WNT
+      return NULLRESULT ;
+#endif  // WNT
+}
+
+
+
diff --git a/src/WOKernel/WOKernel_Entity.cdl b/src/WOKernel/WOKernel_Entity.cdl
new file mode 100755 (executable)
index 0000000..a011c7d
--- /dev/null
@@ -0,0 +1,169 @@
+-- File:       WOKernel_Entity.cdl
+-- Created:    Fri Jun 23 16:13:38 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class Entity from WOKernel
+inherits BaseEntity from WOKernel
+
+       ---Purpose: Base class of WOK entities (Factories, Warehouses,
+       --          Workshops, Workbenches, Development units.)
+       --          
+       
+uses
+    HAsciiString         from TCollection,
+    PSession             from WOKernel,
+    Session              from WOKernel,
+    PEntity              from WOKernel,
+    Entity               from WOKernel,
+    FileTypeBase         from WOKernel,
+    FileType             from WOKernel,
+    DBMSID               from WOKernel,
+    StationID            from WOKernel,
+    HSequenceOfStationID from WOKernel,
+    HSequenceOfDBMSID    from WOKernel,
+    HSequenceOfParamItem from WOKUtils,
+    Param                from WOKUtils
+
+raises ProgramError from Standard
+
+is
+    Initialize(aname    : HAsciiString from TCollection; anesting : Entity from WOKernel)
+    ---Purpose: Initialize a WOKernel Entity
+       raises ProgramError from Standard;
+
+
+    EntityCode(me) 
+       returns HAsciiString from TCollection
+       is deferred;
+
+    GetParams(me:mutable);
+    
+    GetParameters(me:mutable)
+    is virtual protected;
+
+    SetParams(me:mutable; aparam : Param from WOKUtils);
+    ---Purpose: change Parameters of Entity    
+
+    ChangeParams(me:mutable)
+    ---Purpose: Get parameters of Entity    
+    ---C++: inline
+    ---C++: return &
+               returns Param from WOKUtils is static;
+
+    Params(me)
+    ---Purpose: Get parameters of Entity    
+    ---C++: inline
+    ---C++: return const &
+               returns Param from WOKUtils is static;
+
+    ParameterName(me; aname : CString from Standard)
+       returns HAsciiString from TCollection is static;
+
+    EvalParameter(me; aparamname : CString from Standard; isnecessary : Boolean from Standard = Standard_True) 
+    ---Purpose: Evaluates a parameter for the entity
+    --          Name_<aparamname> is evaluated
+       returns HAsciiString from TCollection is static;
+
+    EvalDefaultParameterValue(me : mutable; aparamname : HAsciiString from TCollection;
+                                           evaldepth  : Integer      from Standard = 0)  
+    ---Purpose: Looks up for a default value to Parameter <aparamname>
+       returns HAsciiString from TCollection is static;
+
+
+    --SetProfileParameters(me : mutable;  adbms    : DBMSID    from WOKernel;
+    --                                 astation : StationID from WOKernel);
+    ---Purpose: Sets profile parameters 
+    --              %Station = ao1|sun|hp|sil
+    --              %DBMS    = MEM|OBJY|OBJS|OO2
+    --              %Nesting_Station = %Nesting_%Station
+    --              %Nesting_DBMS    = %Nesting_%DBMS
+
+    SetFileTypeBase(me:mutable; abase : FileTypeBase from WOKernel) is protected;
+
+    FileTypeBase(me)
+       returns FileTypeBase from WOKernel;
+
+    GetFileType(me; atypename : HAsciiString from TCollection) 
+       returns FileType from WOKernel;
+
+    GetFileType(me; atypename : CString from Standard) 
+       returns FileType from WOKernel;
+
+    DumpBuildParameters(me; aparamseq : HSequenceOfParamItem from WOKUtils); 
+    ---Purpose: Dumps in a file the construction parameters of Entity    
+
+    BuildParameters(me: mutable; someparams : HSequenceOfParamItem from WOKUtils; usedefaults : Boolean from Standard)
+    ---Purpose: constructs Sequence of Parameters Needed by Entity
+    --          to be built.
+    --          Checks their consistancy
+       returns HSequenceOfParamItem from WOKUtils is virtual;
+
+    IsValidName(me)
+    ---Purpose: Checks if name given to the entity is valid
+    --          (forbidden characters are : " /<>\{}*~"
+    returns Boolean
+    is virtual;
+    
+    
+    IsValidName(myclass; aname : HAsciiString from TCollection)
+    ---Purpose: Checks if name given to the entity is valid
+    --          (forbidden characters are : " /<>\{}*~_"
+    returns Boolean;
+
+    Build(me: mutable; someparams : HSequenceOfParamItem from WOKUtils)
+    ---Purpose: Creates On disk the Entity
+    --          it must neither be opened or existing    
+    --          Parameters must all be present in someparams
+       raises ProgramError from Standard is virtual;  
+    
+    Destroy(me: mutable) is virtual;
+    ---Purpose: Destroys Entity on Disk
+    --          it must not be opened    
+    
+    Open(me: mutable) 
+    ---Purpose: open an existing entity    
+       raises ProgramError from Standard
+       is deferred;
+       
+    SetOpened(me:mutable) is static;
+    ---Purpose: Flag Entity as Opened    
+    
+    Reset(me: mutable) is virtual;
+    ---Purpose: resets Entity fields (eq:Close)    
+    
+    Close(me: mutable) is deferred;
+    ---Purpose: closes entity
+    
+    SetClosed(me:mutable) is static;
+    ---Purpose: flag entity as closed    
+    
+    IsOpened(me) returns Boolean is static;
+    ---C++: inline
+    ---Purpose: tests if Entity is opened    
+
+    GetUniqueName(me)
+    ---Purpose: Calcultes the unique name of base entity
+       returns HAsciiString from TCollection is redefined;
+       
+    NestedUniqueName(me; aname : HAsciiString from TCollection)
+    ---Purpose: Calculates the unique name of an Entity Nested in Entity
+       returns HAsciiString from TCollection is static;
+
+    Stations(me)   returns HSequenceOfStationID from WOKernel;
+    DBMSystems(me) returns HSequenceOfDBMSID    from WOKernel;
+
+    Kill(me: mutable);
+    ---Purpose: Destroys The Entity    
+    ---C++: alias ~
+
+fields
+    myparams      : Param                   from WOKUtils;
+    mytypes       : FileTypeBase            from WOKernel;
+    myopenstatus  : Boolean                 from Standard;
+    mystations    : HSequenceOfStationID    from WOKernel;
+    mydbmss       : HSequenceOfDBMSID       from WOKernel;
+  
+end Entity;
diff --git a/src/WOKernel/WOKernel_Entity.cxx b/src/WOKernel/WOKernel_Entity.cxx
new file mode 100755 (executable)
index 0000000..ad4600b
--- /dev/null
@@ -0,0 +1,931 @@
+// File:       WOKernel_Entity.cxx
+// Created:    Thu Jun 29 13:56:44 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <Standard_ProgramError.hxx>
+
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKTools_MapOfHAsciiString.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_PathIterator.hxx>
+#include <WOKUtils_ParamItem.hxx>
+#include <WOKUtils_HSequenceOfParamItem.hxx>
+#include <WOKUtils_Shell.hxx>
+#include <WOKUtils_ShellManager.hxx>
+
+#include <WOKernel_Session.hxx>
+#include <WOKernel_File.hxx>
+#include <WOKernel_FileType.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DBMSystem.hxx>
+
+#include <WOKernel_FileTypeKeyWords.hxx>
+
+#include <WOKernel_Entity.ixx>
+
+#ifdef WNT
+# define PATH_SEPARATOR "; \t\n"
+#else
+# define PATH_SEPARATOR ": \t\n"
+#endif  // WNT
+//=======================================================================
+//function : WOKernel_Entity
+//purpose  : WOKernel Entity initializer
+//=======================================================================
+WOKernel_Entity::WOKernel_Entity(const Handle(TCollection_HAsciiString)& aname, 
+                                const Handle(WOKernel_Entity)& anesting) 
+  : WOKernel_BaseEntity(aname, anesting), myopenstatus(Standard_False)
+{
+  myfullname = GetUniqueName();
+}
+
+//=======================================================================
+//function : GetParams
+//purpose  : 
+//=======================================================================
+void WOKernel_Entity::GetParams() 
+{
+  Handle(WOKernel_Entity) entity;
+
+  GetParameters();
+
+  if(!Nesting().IsNull())
+    {
+      // Entites quelconques
+
+      entity = Session()->GetEntity(Nesting());
+
+      Params().Set((Standard_CString)ENTITYVAR,      Name()->ToCString());
+      Params().Set((Standard_CString)ENTITYPATHVAR,  FullName()->ToCString());
+      Params().Set((Standard_CString)ENTITYTYPEVAR,  EntityCode()->ToCString());
+      Params().Set((Standard_CString)NESTINGVAR,     entity->Name()->ToCString());
+      Params().Set((Standard_CString)NESTINGPATHVAR, entity->FullName()->ToCString());
+      Params().Set((Standard_CString)NESTINGTYPEVAR, entity->EntityCode()->ToCString());
+
+      Params().Set((Standard_CString)STATIONVAR, WOKernel_Station::GetName(Session()->Station())->ToCString());
+      Params().Set((Standard_CString)DBMSVAR, WOKernel_DBMSystem::GetName(Session()->DBMSystem())->ToCString());
+
+      if(IsKind(STANDARD_TYPE(WOKernel_DevUnit)))
+       {
+         Handle(TCollection_HAsciiString) sts = entity->EvalParameter((Standard_CString) STATIONS_SUFFIX,Standard_False);
+         Handle(TCollection_HAsciiString) dbs = entity->EvalParameter((Standard_CString) DBMSYSTEMS_SUFFIX,Standard_False);
+
+        if(sts.IsNull()) {
+                 ErrorMsg << "WOKernel_Entity::GetParams"
+                                  << "Parameter " << ParameterName((Standard_CString) STATIONS_SUFFIX) << " is not setted using current station : " << WOKernel_Station::GetName(Session()->Station()) << endm;
+                 sts = new TCollection_HAsciiString(WOKernel_Station::GetName(Session()->Station()));
+         }
+         mystations = WOKernel_Station::GetHSeqOfStation(sts);
+
+         if(dbs.IsNull()) {
+                 ErrorMsg << "WOKernel_Entity::GetParams"
+                                  << "Parameter " << ParameterName((Standard_CString) DBMSYSTEMS_SUFFIX) << " is not setted using current dbmsystem : " << WOKernel_DBMSystem::GetName(Session()->DBMSystem()) << endm;
+                 dbs = new TCollection_HAsciiString(WOKernel_DBMSystem::GetName(Session()->DBMSystem()));
+         }
+         mydbmss    = WOKernel_DBMSystem::GetHSeqOfDBMS(dbs);
+         
+         Params().Set(ParameterName("Stations")->ToCString(), sts->ToCString());
+         Params().Set(ParameterName("DBMSystems")->ToCString(), dbs->ToCString());
+       }
+      else
+       {
+         mystations = WOKernel_Station::GetHSeqOfStation(EvalParameter("Stations",Standard_False));
+         mydbmss    = WOKernel_DBMSystem::GetHSeqOfDBMS(EvalParameter("DBMSystems",Standard_False));
+       }
+
+      Params().Set((Standard_CString)LOCALARCHVAR, Session()->Params().Eval((Standard_CString)LOCALARCHVAR)->ToCString());
+    }
+  else
+    {
+      // Session
+
+      Params().Set((Standard_CString)ENTITYVAR,  Name()->ToCString());
+      Params().Set((Standard_CString)ENTITYTYPEVAR, EntityCode()->ToCString());
+
+    }
+
+}
+
+//=======================================================================
+//function : GetParameters
+//purpose  :  
+//=======================================================================
+void WOKernel_Entity::GetParameters()
+{
+  Standard_Integer i;
+  Handle(TColStd_HSequenceOfAsciiString) aseq;
+  Handle(TColStd_HSequenceOfAsciiString) subclasses = new TColStd_HSequenceOfAsciiString;
+  Handle(TColStd_HSequenceOfAsciiString) dirs       = new TColStd_HSequenceOfAsciiString;
+  Handle(TCollection_HAsciiString) astr;
+  Handle(TCollection_HAsciiString) libdir;
+  Handle(WOKernel_Entity) entity;
+
+  if(!Nesting().IsNull())
+    {
+      // Entites quelconques
+
+      entity = Session()->GetEntity(Nesting());
+
+      aseq = entity->Params().SubClasses();
+      if(!aseq.IsNull())
+       {
+         for(i=1; i<=aseq->Length(); i++)
+           {
+             subclasses->Append(aseq->Value(i));
+           }
+       }
+      subclasses->Append(Name()->ToCString());
+
+      aseq =  entity->Params().SearchDirectories();
+      if(!aseq.IsNull())
+       {
+         for(i=1; i<=aseq->Length(); i++)
+           {
+             dirs->Append(aseq->Value(i));
+           }
+       }
+      //ChangeParams().SetSubClasses(subclasses);
+      //ChangeParams().SetSearchDirectories(dirs);
+
+      // on evalue le ADM
+      //astr = EvalParameter("Adm", Standard_False);
+      astr = entity->Params().Eval(ParameterName("Adm")->ToCString(), Standard_False);
+      
+      if(!astr.IsNull())
+       {
+         dirs->Prepend(astr->ToCString());
+         TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+         lastsub.AssignCat("@");
+         lastsub.AssignCat(astr->String());
+       }
+      ChangeParams().SetSubClasses(subclasses);
+      ChangeParams().SetSearchDirectories(dirs);
+    }
+  else
+    {
+      // Session
+      subclasses->Append(Name()->ToCString());
+
+      // on evalue le WOK_LIBRARY
+      astr = EvalParameter("WokLibPath", Standard_False);
+
+      i=1;
+      libdir = astr->Token(PATH_SEPARATOR, i);
+
+      while(!libdir->IsEmpty())
+       {
+         dirs->Append(libdir->ToCString());
+         i++;
+         libdir = astr->Token(PATH_SEPARATOR, i);
+       }
+
+      // on evalue le ADM
+      astr = EvalParameter("Adm", Standard_False);
+
+      if(!astr.IsNull())
+       {
+         dirs->Prepend(astr->ToCString());
+         TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+         lastsub.AssignCat("@");
+         lastsub.AssignCat(astr->String());
+       }
+
+      ChangeParams().SetSubClasses(subclasses);
+      ChangeParams().SetSearchDirectories(dirs);
+    }
+
+}  
+
+
+//=======================================================================
+//function : SetParam
+//purpose  : sets Entity parameters 
+//=======================================================================
+void WOKernel_Entity::SetParams(const WOKUtils_Param& aparam)
+{
+  myparams = aparam;
+}
+
+//=======================================================================
+//function : ParameterName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Entity::ParameterName(const Standard_CString aparamname) const
+{
+  Handle(TCollection_HAsciiString) aname=new TCollection_HAsciiString;
+
+  aname->AssignCat("%");
+  aname->AssignCat(Name());
+  aname->AssignCat("_");
+  aname->AssignCat(aparamname);
+  return aname;
+}
+
+//=======================================================================
+//function : EvalParameter
+//purpose  : Evaluates a parameter of Entity
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Entity::EvalParameter(const Standard_CString aparamname, const Standard_Boolean isnecessary) const
+{
+  Handle(TCollection_HAsciiString) result;
+
+  result = myparams.Eval(ParameterName(aparamname)->ToCString(), Standard_False);
+
+  if(result.IsNull() && isnecessary ) 
+    {
+      ErrorMsg << "WOKernel_Entity::EvalParameter" 
+              << "Parameter " << aparamname << " could not be evaluated" << endm;
+      Standard_ProgramError::Raise("WOKernel_Entity::EvalParameter");
+    }
+  return result;
+}
+
+//=======================================================================
+//function : EvalDefaultParameterValue
+//purpose  : look up for a default value to parameter aname
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Entity::EvalDefaultParameterValue(const Handle(TCollection_HAsciiString)& aname,
+                                                                           const Standard_Integer evaldepth)
+{
+  Handle(TCollection_HAsciiString) result, nesting, argval;
+  Handle(TColStd_HSequenceOfHAsciiString) argseq;
+  Standard_Integer nestlen = strlen(NESTING_PREFIX);
+  Standard_Integer entlen  = strlen(ENTITY_PREFIX);
+  Standard_Integer i, depth;
+  TCollection_AsciiString astr;
+  Handle(WOKernel_Entity) thenest;
+
+  Params().LoadParamClass("DEFAULT",Params().SubClasses());
+
+  if(Params().IsSet(ParameterName(aname->ToCString())->ToCString()))
+    {
+      result = EvalParameter(aname->ToCString());
+      return result;
+    }
+  
+  if(evaldepth > 20 )
+    {
+      ErrorMsg << "WOKernel_Entity::EvalDefaultParameterValue" 
+              << "Too many levels in DEFAULT parameter evaluation" << endm;
+      return result;
+    }
+
+  if(!evaldepth)
+    {
+      myparams.Set((Standard_CString)ENTITYVAR, Name()->ToCString());
+      
+      if(!Nesting().IsNull())
+       {
+         thenest = Session()->GetEntity(Nesting());
+         nesting = thenest->Name();
+         myparams.Set((Standard_CString)NESTINGVAR, nesting->ToCString());
+       }
+      else
+       {
+         myparams.Set((Standard_CString)NESTINGVAR, "NoNestingSetted");
+       }
+    }
+
+  astr.AssignCat("DEFAULT_");
+  astr.AssignCat(aname->ToCString());
+
+  if(Params().IsSet(astr.ToCString()))
+    {
+      argseq = Params().GetArguments(astr.ToCString());
+      depth = evaldepth;
+      depth++;
+
+      for(i=1; i<= argseq->Length(); i++)
+       {
+         if(!myparams.IsSet(argseq->Value(i)->ToCString()))
+           {
+             if(!strncmp(argseq->Value(i)->ToCString(), NESTING_PREFIX, nestlen))
+               {
+                 argval.Nullify();
+                 if(!thenest.IsNull())
+                   {
+                     argval = thenest->EvalDefaultParameterValue(argseq->Value(i)->SubString(nestlen+1, argseq->Value(i)->Length()), depth);
+                   }
+
+                 if(!argval.IsNull())
+                   {
+                     myparams.Set(argseq->Value(i)->ToCString(), argval->ToCString());
+                   }
+                 else
+                   {
+                     ErrorMsg << "WOKernel_Entity::EvalDefaultParameterValue" 
+                              << "Could not eval default value for argument : " <<  argseq->Value(i) << endm;
+                     return result;
+                   }
+               }
+             else if(!strncmp(argseq->Value(i)->ToCString(), ENTITY_PREFIX, entlen))
+               {
+                 argval = EvalDefaultParameterValue(argseq->Value(i)->SubString(entlen+1, argseq->Value(i)->Length()), depth);
+             
+                 if(!argval.IsNull())
+                   {
+                     myparams.Set(argseq->Value(i)->ToCString(), argval->ToCString());
+                   }
+                 else
+                   {
+                     ErrorMsg << "WOKernel_Entity::EvalDefaultParameterValue" 
+                              << "Could not eval default value for argument : " <<  argseq->Value(i) << endm;
+                     return result;
+                   }
+               }
+             else
+               {
+                 ErrorMsg << "WOKernel_Entity::EvalDefaultParameterValue" 
+                          << "Default value Argument not set : " << argseq->Value(i) << endm;
+                 return result;
+               }
+           }
+       }
+  
+      result = myparams.Eval(astr.ToCString());
+    }
+  
+  myparams.UnSet((Standard_CString)ENTITYVAR);
+  myparams.UnSet((Standard_CString)NESTINGVAR);
+
+  return result;
+}
+
+//=======================================================================
+//function : SetFileTypeBase
+//purpose  : 
+//=======================================================================
+void WOKernel_Entity::SetFileTypeBase(const Handle(WOKernel_FileTypeBase)& abase)
+{
+  mytypes = abase;
+}
+
+//=======================================================================
+//function : FileTypeBase
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_FileTypeBase) WOKernel_Entity::FileTypeBase() const
+{
+  return mytypes;
+}
+
+//=======================================================================
+//function : GetFileType
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_FileType) WOKernel_Entity::GetFileType(const Handle(TCollection_HAsciiString)& atypename) const
+{
+  return mytypes->Type(atypename);
+}
+
+//=======================================================================
+//function : GetFileType
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_FileType) WOKernel_Entity::GetFileType(const Standard_CString atypename) const
+{
+  return mytypes->Type(atypename);
+}
+
+//=======================================================================
+//function : DumpBuildParameters
+//purpose  : Creates file containing parameters used to create Entity
+//=======================================================================
+void WOKernel_Entity::DumpBuildParameters(const Handle(WOKUtils_HSequenceOfParamItem)& someparams) const
+{
+  Handle(WOKernel_File) deffile;
+  Handle(WOKernel_FileType) deftype;
+
+  if(!FileTypeBase()->IsType("DefinitionFile")) return;
+
+  deftype  = GetFileType("DefinitionFile");
+
+  if(deftype->IsFileDependent())
+    {
+      WarningMsg << "WOKernel_Entity::DumpBuildParameters"
+                << "Incorrect DefinitionFile definition for " << UserPathName() << " : No file created" << endm;
+      return;
+    }
+
+  deffile = new WOKernel_File(this, deftype);
+  deffile->GetPath();
+
+  // On "Dump" le fichier de config
+  myparams.Write(deffile->Path(), someparams);
+}
+
+//=======================================================================
+//function : BuildParameters
+//purpose  : 
+//=======================================================================
+Handle(WOKUtils_HSequenceOfParamItem) WOKernel_Entity::BuildParameters(const Handle(WOKUtils_HSequenceOfParamItem)& someparams,
+                                                                      const Standard_Boolean usedefaults) 
+{
+  Standard_Integer i, apos;
+  Handle(WOKUtils_HSequenceOfParamItem)   result = new WOKUtils_HSequenceOfParamItem;
+  Handle(WOKernel_FileTypeBase)           abase  = new WOKernel_FileTypeBase;  
+  Handle(TColStd_HSequenceOfHAsciiString) needed;
+  Handle(TCollection_HAsciiString)        nullhandle, stations, dbmss, aname, avalue;
+  
+
+  Params().Set(Params().ClassLoadFlag(Name()->ToCString())->ToCString(), "");
+
+  Params().Set(someparams);
+  GetParams();
+  Params().Set(someparams);
+
+  abase->Load(Params());  
+  SetFileTypeBase(abase);
+
+  // evaluation des DBMS et STATIONS
+  
+  if(usedefaults)
+    {
+      dbmss    = EvalDefaultParameterValue(new TCollection_HAsciiString("DBMSystems"));
+      stations = EvalDefaultParameterValue(new TCollection_HAsciiString("Stations"));
+    }
+  else
+    {
+      dbmss    = EvalParameter("DBMSystems");
+      stations = EvalParameter("Stations");
+    }
+
+  mystations = WOKernel_Station::GetHSeqOfStation(stations);
+  mydbmss    = WOKernel_DBMSystem::GetHSeqOfDBMS(dbmss);
+
+  needed = FileTypeBase()->GetNeededParameters(nullhandle, Name(), mydbmss, mystations);
+  WOKTools_MapOfHAsciiString amap;
+
+  for(i=1; i<=needed->Length(); i++)
+    {
+      if(!amap.Contains(needed->Value(i)))
+       {
+         aname = needed->Value(i);
+         avalue.Nullify();
+         if(usedefaults)
+           {
+             apos = aname->Search("_");
+             if(apos > 1)
+               {
+                 avalue = EvalDefaultParameterValue(aname->SubString(apos+1, aname->Length()));
+               }
+           }
+         else
+           {
+             avalue = EvalParameter(needed->Value(i)->ToCString());
+           }
+
+         result->Append(WOKUtils_ParamItem(needed->Value(i), avalue));
+         amap.Add(needed->Value(i));
+       }
+    }
+
+  return result;
+}
+
+//=======================================================================
+//function : IsValidName
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Entity::IsValidName() const
+{
+  return WOKernel_Entity::IsValidName(Name());
+}
+
+
+//=======================================================================
+//function : IsValidName
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Entity::IsValidName(const Handle(TCollection_HAsciiString)& aname) 
+{
+  Standard_Integer   i;
+  Standard_Character c;
+  
+  if(aname.IsNull()) return Standard_False;
+  
+  for (i=1; i<= aname->Length(); i++)
+    {
+      c = aname->Value(i);
+      if (!IsAlphanumeric(c) && !IsEqual(c,'-'))
+       return Standard_False;
+    }
+  
+  return Standard_True;
+}
+
+//=======================================================================
+//function : Build
+//purpose  : 
+//=======================================================================
+void WOKernel_Entity::Build(const Handle(WOKUtils_HSequenceOfParamItem)& someparams)
+{
+  Standard_Integer i;
+  Handle(TColStd_HSequenceOfHAsciiString) dirs, files;
+  Handle(TCollection_HAsciiString)        nesting ;
+  Handle(WOKUtils_Path) apath;
+  Handle(WOKernel_FileTypeBase) abase;
+
+  if (!IsValidName()) {
+    ErrorMsg << "WOKernel_Entity::Build" 
+      << "Invalid Name for entity : " << Name() << endm;
+    return;
+  }
+
+  if(Session()->IsKnownEntity(FullName()))
+    {
+      ErrorMsg << "WOKernel_Entity::Build" 
+              << "An Entity with name " << UserPathName() << " is already defined" << endm;
+      return;
+    }
+    
+  Session()->AddEntity(this);
+
+  Params().Set(someparams);
+  GetParams();
+  Params().Set(someparams);
+  Params().Set(Params().ClassLoadFlag(Name()->ToCString())->ToCString(), "");
+
+  mystations = WOKernel_Station::GetHSeqOfStation(EvalParameter("Stations"));
+  mydbmss    = WOKernel_DBMSystem::GetHSeqOfDBMS(EvalParameter("DBMSystems"));
+
+  abase = new WOKernel_FileTypeBase;
+  abase->Load(Params());  
+  SetFileTypeBase(abase);
+
+  // Preparation du shell
+  Handle(WOKUtils_Shell) buildsh = WOKUtils_ShellManager::GetShell();
+
+  if(!buildsh->IsLaunched()) buildsh->Launch();
+  buildsh->Lock();
+
+  // Execution du before
+
+  if(Params().IsSet((Standard_CString) WOKENTITYBEFOREBUID))
+    {
+      Handle(TCollection_HAsciiString) cmd;
+
+      cmd = Params().Eval((Standard_CString) WOKENTITYBEFOREBUID);
+
+      if(!cmd.IsNull())
+       {
+         buildsh->ClearOutput();
+         
+         WOK_TRACE {
+           VerboseMsg("WOK_CREATE") << "WOKernel_Entity::Build" 
+                                    << "Launching before command : " << cmd << endm;
+         }
+         
+         buildsh->Execute(cmd);
+
+         if(buildsh->Status())
+           {
+             ErrorMsg << "WOKernel_Entity::Build" 
+                      << "Errors occured in BeforeBuild :" << endm;
+
+             Handle(TColStd_HSequenceOfHAsciiString) aseq = buildsh->Errors();
+             Standard_Integer i;
+
+             for(i=1; i<=aseq->Length(); i++)
+               {
+                 ErrorMsg << "WOKernel_Entity::Build" << aseq->Value(i) << endm;
+               }
+           }
+       }
+    }
+
+  nesting = Session()->GetEntity(Nesting())->Name();
+
+  dirs = FileTypeBase()->GetDirectories(this, mydbmss, mystations, Standard_True);
+  
+  for(i=1; i<=dirs->Length(); i++)
+    {
+      WOK_TRACE {
+       VerboseMsg("WOK_CREATE") << "WOKernel_Entity::Build" 
+                                << "Creating directory : " << dirs->Value(i) << endm;
+      }
+
+      apath = new WOKUtils_Path(dirs->Value(i));
+      if (!apath->CreateDirectory(Standard_True)) {
+       ErrorMsg << "WOKernel_Entity::Build" 
+         << "Enable to create directory " << dirs->Value(i) << endm;
+      }
+    }
+
+  files = FileTypeBase()->GetFiles(this, mydbmss, mystations, Standard_True);
+
+  for(i=1; i<=files->Length(); i++)
+    {
+      WOK_TRACE {
+       VerboseMsg("WOK_CREATE") << "WOKernel_Entity::Build" 
+                                << "Creating file : " << files->Value(i) << endm;
+      }
+      
+      apath = new WOKUtils_Path(files->Value(i));
+      apath->CreateFile(Standard_True);
+    }
+
+  // Execution du after
+
+  if(Params().IsSet((Standard_CString) WOKENTITYAFTERBUILD))
+    {
+      Handle(TCollection_HAsciiString) cmd;
+
+      cmd = Params().Eval((Standard_CString) WOKENTITYAFTERBUILD);
+
+      if(!cmd.IsNull())
+       {
+         buildsh->ClearOutput();
+
+         WOK_TRACE {
+           VerboseMsg("WOK_CREATE") << "WOKernel_Entity::Build" 
+                                    << "Launching after command : " << cmd << endm;
+         }
+         
+         buildsh->Execute(cmd);
+         
+         if(buildsh->Status())
+           {
+             ErrorMsg << "WOKernel_Entity::Build" 
+                      << "Errors occured in AfterBuild :" << endm;
+
+             Handle(TColStd_HSequenceOfHAsciiString) aseq = buildsh->Errors();
+             Standard_Integer i;
+
+             for(i=1; i<=aseq->Length(); i++)
+               {
+                 ErrorMsg << "WOKernel_Entity::Build" << aseq->Value(i) << endm;
+               }
+           }
+
+       }
+    }
+
+  buildsh->UnLock();
+
+  DumpBuildParameters(someparams);
+
+  Session()->RemoveEntity(this);
+  return;
+}
+
+//=======================================================================
+//function : Destroy
+//purpose  : 
+//=======================================================================
+void WOKernel_Entity::Destroy()
+{
+  Handle(TColStd_HSequenceOfHAsciiString) dirs, files;
+  Handle(TCollection_HAsciiString)        nesting ;
+  Handle(WOKUtils_Path) apath;
+  Standard_Integer i;
+
+  if(!IsOpened())
+    {
+      ErrorMsg << "WOKernel_Entity::Destroy" 
+              << UserPathName() << " has to be opened to be destroyed" << endm;
+      return;
+    }
+
+  // Preparation du shell
+  Handle(WOKUtils_Shell) buildsh = WOKUtils_ShellManager::GetShell();
+  
+  if(!buildsh->IsLaunched()) buildsh->Launch();
+  buildsh->Lock();
+
+  // Execution du before
+
+  if(Params().IsSet((Standard_CString) WOKENTITYBEFOREDESTROY))
+    {
+      Handle(TCollection_HAsciiString) cmd;
+
+      cmd = Params().Eval((Standard_CString) WOKENTITYBEFOREDESTROY);
+
+      if(!cmd.IsNull())
+       {
+         buildsh->ClearOutput();
+
+         WOK_TRACE {
+           VerboseMsg("WOK_DESTROY") << "WOKernel_Entity::Destroy" 
+                                     << "Launching before command : " << cmd << endm;
+         }
+
+         buildsh->Execute(cmd);
+
+         if(buildsh->Status())
+           {
+             ErrorMsg << "WOKernel_Entity::Destroy" 
+                      << "Errors occured in BeforeDestroy :" << endm;
+
+             Handle(TColStd_HSequenceOfHAsciiString) aseq = buildsh->Errors();
+             Standard_Integer i;
+
+             for(i=1; i<=aseq->Length(); i++)
+               {
+                 ErrorMsg << "WOKernel_Entity::Destroy" << aseq->Value(i) << endm;
+               }
+           }
+
+       }
+    }
+
+  nesting = Session()->GetEntity(Nesting())->Name();
+
+  files = FileTypeBase()->GetFiles(this, mydbmss, mystations, Standard_True);
+
+  for(i=1; i<=files->Length(); i++)
+    {
+      WOK_TRACE {
+       VerboseMsg("WOK_DESTROY") << "WOKernel_Entity::Destroy" 
+                                 << "Destroying file : " << files->Value(i) << endm;
+      }
+      
+      apath = new WOKUtils_Path(files->Value(i));
+
+      if(apath->Exists())
+       apath->RemoveFile();
+    }
+
+  dirs = FileTypeBase()->GetDirectories(this, mydbmss, mystations, Standard_True);
+  
+  for(i=dirs->Length(); i>=1; i--)
+    {
+      WOK_TRACE {
+       VerboseMsg("WOK_DESTROY") << "WOKernel_Entity::Destroy" 
+                                 << "Destroying dir  : " << dirs->Value(i) << endm;
+      }
+
+      apath = new WOKUtils_Path(dirs->Value(i));
+
+      if(apath->Exists())
+       {
+         WOKUtils_PathIterator anit(apath, Standard_True);
+
+         while(anit.More())
+           {
+             // suprimer les enfants
+             Handle(WOKUtils_Path) apath = anit.PathValue();
+             
+             if(apath->IsDirectory())
+               {
+                 WarningMsg << "WOKernel_Entity::Destroy" 
+                   << "Removing dir  : " << apath->Name() << endm;
+                 apath->RemoveDirectory(Standard_False);
+               }
+             else
+               {
+                 WarningMsg << "WOKernel_Entity::Destroy" 
+                   << "Removing file  : " << apath->Name() << endm;
+                 apath->RemoveFile();
+               }
+             anit.Next();
+           }
+         apath->RemoveDirectory(Standard_False);
+       }
+    }
+
+
+  // Execution du after
+
+  if(Params().IsSet((Standard_CString) WOKENTITYAFTERDESTROY))
+    {
+      Handle(TCollection_HAsciiString) cmd;
+
+      cmd = Params().Eval((Standard_CString) WOKENTITYAFTERDESTROY);
+
+      if(!cmd.IsNull())
+       {
+         buildsh->ClearOutput();
+
+         WOK_TRACE {
+           VerboseMsg("WOK_DESTROY") << "WOKernel_Entity::Destroy" 
+                                     << "Launching after command : " << cmd << endm;
+         }
+         
+         buildsh->Execute(cmd);
+
+         if(buildsh->Status())
+           {
+             ErrorMsg << "WOKernel_Entity::Destroy" 
+                      << "Errors occured in AfterDestroy :" << endm;
+
+             Handle(TColStd_HSequenceOfHAsciiString) aseq = buildsh->Errors();
+             Standard_Integer i;
+
+             for(i=1; i<=aseq->Length(); i++)
+               {
+                 ErrorMsg << "WOKernel_Entity::Destroy" << aseq->Value(i) << endm;
+               }
+           }
+       }
+    }
+
+  buildsh->UnLock();
+  return;
+}
+
+
+//=======================================================================
+//function : SetOpened
+//purpose  : the Entity is flagged to be opened
+//=======================================================================
+void WOKernel_Entity::SetOpened() 
+{
+  myopenstatus = Standard_True;
+}
+
+//=======================================================================
+//function : Reset
+//purpose  : 
+//=======================================================================
+void WOKernel_Entity::Reset()
+{
+  myparams.Clear();
+  mytypes.Nullify();  
+  mystations.Nullify();
+  mydbmss.Nullify();
+}
+
+//=======================================================================
+//function : SetClosed
+//purpose  : the Entity is flagged to be closed
+//=======================================================================
+void WOKernel_Entity::SetClosed() 
+{
+  myopenstatus = Standard_False;
+}
+
+
+
+//=======================================================================
+//function : NestedUniqueName
+//purpose  : Calculates the unique name of an BaseEntity Nested in BaseEntity
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Entity::NestedUniqueName(const Handle(TCollection_HAsciiString)& aname) const
+{
+  Handle(TCollection_HAsciiString) auniqname = new TCollection_HAsciiString(FullName());
+
+  auniqname->AssignCat(":");
+  auniqname->AssignCat(aname);
+  return auniqname;
+}
+
+//=======================================================================
+//function : GetUnitqueName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Entity::GetUniqueName() const
+{
+  if(!Nesting().IsNull())
+    {
+      // pas un Atelier
+      const Handle(WOKernel_Entity)& entity = Session()->GetEntity(Nesting());
+
+      if(!entity.IsNull())
+       {
+         Handle(TCollection_HAsciiString) aname = new TCollection_HAsciiString(entity->UserPathName());
+         if(aname->Length() != 1)
+           aname->AssignCat(":");
+         aname->AssignCat(Name());
+         return aname;
+       }
+      Standard_ProgramError::Raise("WOKernel_Entity::GetUniqueName : Nesting could not be found");
+      return Handle(TCollection_HAsciiString)();
+    }
+  else
+    {
+      return new TCollection_HAsciiString(":");
+    }
+}
+
+//=======================================================================
+//function : DBMSystems
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_HSequenceOfDBMSID) WOKernel_Entity::DBMSystems() const
+{
+  return mydbmss;
+}
+
+//=======================================================================
+//function : Stations
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_HSequenceOfStationID) WOKernel_Entity::Stations() const
+{
+  return mystations;
+}
+
+//=======================================================================
+//function : Kill
+//purpose  : 
+//=======================================================================
+void WOKernel_Entity::Kill() 
+{
+}
diff --git a/src/WOKernel/WOKernel_Entity.lxx b/src/WOKernel/WOKernel_Entity.lxx
new file mode 100755 (executable)
index 0000000..6e38220
--- /dev/null
@@ -0,0 +1,37 @@
+// File:       WOKernel_Entity.lxx
+// Created:    Wed Jul 26 18:37:20 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : ChangeParams
+//purpose  : 
+//=======================================================================
+inline WOKUtils_Param& WOKernel_Entity::ChangeParams()  
+{
+  return myparams;
+}
+
+//=======================================================================
+//function : IsOpened
+//purpose  : is the entity opened ?
+//=======================================================================
+Standard_Boolean WOKernel_Entity::IsOpened() const 
+{
+  return myopenstatus;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Params
+//purpose  : 
+//=======================================================================
+inline const WOKUtils_Param& WOKernel_Entity::Params() const 
+{
+  return myparams;
+}
+
+
diff --git a/src/WOKernel/WOKernel_EntityIterator.cdl b/src/WOKernel/WOKernel_EntityIterator.cdl
new file mode 100755 (executable)
index 0000000..ad8e0c5
--- /dev/null
@@ -0,0 +1,40 @@
+
+class EntityIterator from WOKernel
+uses
+       Session from WOKernel,
+       Entity  from WOKernel,
+       HAsciiString from TCollection,
+       DataMapIteratorOfDataMapOfHAsciiStringOfFactory   from WOKernel,
+       DataMapIteratorOfDataMapOfHAsciiStringOfWarehouse from WOKernel,
+       DataMapIteratorOfDataMapOfHAsciiStringOfWorkshop  from WOKernel,
+       DataMapIteratorOfDataMapOfHAsciiStringOfParcel    from WOKernel,
+       DataMapIteratorOfDataMapOfHAsciiStringOfWorkbench from WOKernel,
+       DataMapIteratorOfDataMapOfHAsciiStringOfDevUnit   from WOKernel
+is
+
+       Create(asession : Session from WOKernel)
+               returns EntityIterator from WOKernel;
+
+       More(me)
+           returns Boolean from Standard;
+
+       Key(me)
+       ---C++: return const &
+               returns HAsciiString from TCollection;
+
+       Value(me)
+       ---C++: return const &
+               returns Entity from WOKernel;
+
+       Next(me:out);
+
+fields
+
+       myfactit : DataMapIteratorOfDataMapOfHAsciiStringOfFactory   from WOKernel;
+       mywareit : DataMapIteratorOfDataMapOfHAsciiStringOfWarehouse from WOKernel;
+       myshopit : DataMapIteratorOfDataMapOfHAsciiStringOfWorkshop  from WOKernel;
+       myparcit : DataMapIteratorOfDataMapOfHAsciiStringOfParcel    from WOKernel;
+       mybenchit: DataMapIteratorOfDataMapOfHAsciiStringOfWorkbench from WOKernel;
+       myunitit : DataMapIteratorOfDataMapOfHAsciiStringOfDevUnit   from WOKernel;
+
+end;
diff --git a/src/WOKernel/WOKernel_EntityIterator.cxx b/src/WOKernel/WOKernel_EntityIterator.cxx
new file mode 100755 (executable)
index 0000000..cdb8111
--- /dev/null
@@ -0,0 +1,57 @@
+
+
+
+#include <WOKernel_EntityIterator.ixx>
+
+WOKernel_EntityIterator::WOKernel_EntityIterator(const Handle(WOKernel_Session)& asession) 
+  : myfactit(asession->myfactories), mywareit(asession->mywarehouses), myshopit(asession->myworkshops), 
+    myparcit(asession->myparcels), mybenchit(asession->myworkbenches), myunitit(asession->myunits)
+{
+}
+
+Standard_Boolean WOKernel_EntityIterator::More() const
+{
+  if(myfactit.More()) return Standard_True;
+  return Standard_False;
+}
+
+
+const Handle(WOKernel_Entity)& WOKernel_EntityIterator::Value() const
+{
+  if(myunitit.More())   return myunitit.Value();
+  if(mybenchit.More())  return mybenchit.Value();
+  if(myparcit.More())   return myparcit.Value();
+  if(myshopit.More())   return myshopit.Value();
+  if(mywareit.More())   return mywareit.Value();
+  if(myfactit.More())   return myfactit.Value();
+  {
+    static Handle(WOKernel_Entity) NULLRESULT;
+    return NULLRESULT;
+  }
+}
+
+const Handle(TCollection_HAsciiString)& WOKernel_EntityIterator::Key() const
+{
+  if(myunitit.More())   return myunitit.Key();
+  if(mybenchit.More())  return mybenchit.Key();
+  if(myparcit.More())   return myparcit.Key();
+  if(myshopit.More())   return myshopit.Key();
+  if(mywareit.More())   return mywareit.Key();
+  if(myfactit.More())   return myfactit.Key();
+  {
+    static Handle(TCollection_HAsciiString) NULLRESULT;
+    return NULLRESULT;
+  }
+}
+
+void WOKernel_EntityIterator::Next()
+{
+  if(myunitit.More())   {myunitit.Next();return;}
+  if(mybenchit.More())  {mybenchit.Next();return;}
+  if(myparcit.More())   {myparcit.Next();return;}
+  if(myshopit.More())   {myshopit.Next();return;}
+  if(mywareit.More())   {mywareit.Next();return;}
+  if(myfactit.More())   {myfactit.Next();return;}
+  return;
+}
+
diff --git a/src/WOKernel/WOKernel_Factory.cdl b/src/WOKernel/WOKernel_Factory.cdl
new file mode 100755 (executable)
index 0000000..d755619
--- /dev/null
@@ -0,0 +1,75 @@
+-- File:       WOKernel_Factory.cdl
+-- Created:    Fri Jun 23 16:55:29 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Factory from WOKernel 
+inherits Entity from WOKernel
+
+
+       ---Purpose: WOK Factory : corresponds to a developpers Team
+
+uses
+    HSequenceOfHAsciiString from TColStd,
+    HAsciiString            from TCollection,
+    Workshop                from WOKernel,
+    Warehouse               from WOKernel,
+    Session                 from WOKernel,
+    Path                    from WOKUtils,
+    HSequenceOfParamItem    from WOKUtils
+raises
+    ProgramError from Standard
+is
+    Create(aname : HAsciiString from TCollection; anesting : Session from WOKernel) 
+    ---Purpose: instantiates a factory    
+       returns mutable Factory from WOKernel; 
+    
+    EntityCode(me) 
+       returns HAsciiString from TCollection
+       is redefined;
+
+    ReadWSLIST(me:mutable);
+    WriteWSList(me:mutable);
+    
+    Open(me: mutable)
+    raises ProgramError from Standard is redefined;
+    ---Purpose: opens a factory 
+    --          loads Workshop list
+    --          load Warehouse parameters
+    
+    Close(me: mutable) is redefined;
+    ---Purpose: closes Factory    
+
+    Workshops(me) 
+    ---Purpose: gives the sequence of workshop in factory
+       returns HSequenceOfHAsciiString from TColStd;
+
+    DumpWorkshopList(me);
+    ---Purpose: updates files WSLIST with myworkshops    
+
+    AddWorkshop(me:mutable; aworkshop : Workshop from WOKernel)
+    ---Purpose: Adds workshop to factory
+    --          Updates WSLIST    
+       raises ProgramError from Standard;
+   
+    RemoveWorkshop(me:mutable; aworkshop : Workshop from WOKernel)
+    ---Purpose: removes workshop    
+       raises ProgramError from Standard;
+    
+    SetWarehouse(me:mutable; awarehouse : Warehouse from WOKernel);
+    Warehouse(me) 
+    ---Purpose: gives the warehouse of factory    
+       returns HAsciiString from TCollection;
+       
+    SetSourceStorage(me:mutable; astorage : Path from WOKUtils);
+    SourceStorage(me)
+    ---Purpose: gives the SCCS repository of factory    
+       returns Path      from WOKUtils;
+    
+fields
+    myworkshops : HSequenceOfHAsciiString from TColStd;
+    mywarehouse : HAsciiString            from TCollection;
+    mysccsbase  : Path                    from WOKUtils;
+end Factory;
diff --git a/src/WOKernel/WOKernel_Factory.cxx b/src/WOKernel/WOKernel_Factory.cxx
new file mode 100755 (executable)
index 0000000..6866fa1
--- /dev/null
@@ -0,0 +1,251 @@
+// File:       WOKernel_Factory.cxx
+// Created:    Thu Jun 29 18:50:43 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <fstream.h>
+
+#include <WOKernel_Factory.ixx>
+
+#include <WOKernel_Workshop.hxx>
+#include <WOKernel_Warehouse.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_File.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_ParamItem.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+//=======================================================================
+//function : WOKernel_Factory
+//purpose  : Factory constructor
+//=======================================================================
+WOKernel_Factory::WOKernel_Factory(const Handle(TCollection_HAsciiString)& aname, const Handle(WOKernel_Session)& anesting) : WOKernel_Entity(aname, anesting)
+{
+  SetSession(anesting);
+}
+
+//=======================================================================
+//function : EntityCode
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Factory::EntityCode() const 
+{
+  static Handle(TCollection_HAsciiString) acode = new TCollection_HAsciiString("factory");
+  return acode;
+}
+
+//=======================================================================
+//function : Open
+//purpose  : Opens an existing factory
+//=======================================================================
+void WOKernel_Factory::Open()
+{
+  if(IsOpened()) return;
+  {
+    Handle(TCollection_HAsciiString) astr;
+    Handle(TColStd_HSequenceOfHAsciiString) aseq;
+    Handle(WOKernel_Workshop)     ashop;
+    Handle(WOKUtils_Path)         apath;
+    Handle(WOKernel_Warehouse)    thewarehouse;
+    Handle(WOKernel_File)         afile;
+    Handle(WOKernel_FileType)     atype;
+    Reset();
+
+    GetParams();
+
+    SetFileTypeBase(Session()->GetFileTypeBase(this));
+
+    afile = new WOKernel_File(this, FileTypeBase()->Type("WorkshopListFile"));
+    afile->GetPath();
+
+    ifstream astream(afile->Path()->Name()->ToCString());
+    char inbuf[1024];
+
+    myworkshops = new TColStd_HSequenceOfHAsciiString();
+
+    while(astream >> setw(1024) >> inbuf)
+      {
+       ashop = new WOKernel_Workshop(new TCollection_HAsciiString(inbuf), Handle(WOKernel_Factory)(this));
+       myworkshops->Append(ashop->FullName());
+       Session()->AddEntity(ashop);
+      }
+    astream.close();
+
+    // charger le warehouse et l'ouvrir
+    thewarehouse = new WOKernel_Warehouse(EvalParameter("Warehouse"), Handle(WOKernel_Factory)(this));
+    mywarehouse = thewarehouse->FullName();
+    
+    if(Params().IsClassVisible(thewarehouse->Name()->ToCString()))
+      {
+       mywarehouse = thewarehouse->FullName();
+       Session()->AddEntity(thewarehouse);
+      }
+    
+
+    // charger la base SCCS
+    afile = new WOKernel_File(astr, this, FileTypeBase()->Type("SCCSDir"));
+    afile->GetPath();
+
+    mysccsbase = afile->Path();
+
+    SetOpened();
+  }
+  return;
+}
+
+//=======================================================================
+//function : Close
+//purpose  : Closes an opened factory
+//=======================================================================
+void WOKernel_Factory::Close()
+{
+  if(!IsOpened()) return;
+
+  Handle(WOKernel_Workshop) ashop;
+  Handle(WOKernel_Warehouse) abag;
+
+  Standard_Integer i;
+  
+  for(i=1; i <= myworkshops->Length(); i++)
+    {
+      ashop = Session()->GetWorkshop(myworkshops->Value(i));
+      ashop->Close();
+      Session()->RemoveEntity(ashop);
+    }
+  abag = Session()->GetWarehouse(mywarehouse);
+  if(!abag.IsNull())
+    {
+      abag->Close();
+      Session()->RemoveEntity(abag);
+      mywarehouse.Nullify();
+    }
+
+  myworkshops.Nullify();
+  Reset();
+  SetClosed();
+  return;
+}
+
+//=======================================================================
+//function : Workshops
+//purpose  : Gives the list of the kown Workshop in factory
+//=======================================================================
+ Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Factory::Workshops() const 
+{
+  return myworkshops;
+}
+
+//=======================================================================
+//function : DumpWorkshopList
+//purpose  : updates Workshop list
+//=======================================================================
+void WOKernel_Factory::DumpWorkshopList() const
+{
+  Standard_Integer i;
+  Handle(TCollection_HAsciiString) name;
+  Handle(WOKernel_File) afile;
+
+  afile = new WOKernel_File(this, GetFileType("WorkshopListFile"));
+  afile->GetPath();
+
+  ofstream astream(afile->Path()->Name()->ToCString(), ios::out);
+
+  if(!astream)
+    {
+      ErrorMsg << "WOKernel_Factory::AddWorkshop" << "Could not open " << afile->Path()->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_Factory::AddWorkshop");
+    }
+
+  for(i = 1 ; i <= myworkshops->Length() ; i++)
+    {
+      name = Session()->GetWorkshop(myworkshops->Value(i))->Name();
+      astream << name->ToCString() << endl;
+    }
+  return;
+  
+}
+
+//=======================================================================
+//function : AddWorkshop
+//purpose  : Adds a workshop in the list of workshops (i.e. updates WSLIST)
+//=======================================================================
+void WOKernel_Factory::AddWorkshop(const Handle(WOKernel_Workshop)& aworkshop)
+{
+  if(Session()->IsKnownEntity(aworkshop->FullName()))
+    {
+      ErrorMsg << "WOKernel_Factory::AddWorkshop" << "There is already an entity named " <<  aworkshop->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_Factory::AddWorkshop");
+    }
+
+  myworkshops->Append(aworkshop->FullName());
+  Session()->AddEntity(aworkshop);
+
+  DumpWorkshopList();
+  return;
+}
+
+//=======================================================================
+//function : RemoveWorkshop
+//purpose  : removes a workshop in the list of workshops (i.e. updates WSLIST)
+//=======================================================================
+void WOKernel_Factory::RemoveWorkshop(const Handle(WOKernel_Workshop)& aworkshop)
+{
+  Standard_Integer i;
+
+  for(i = 1 ; i <= myworkshops->Length() ; i++)
+    {
+      if(myworkshops->Value(i)->IsSameString(aworkshop->FullName()))
+       {myworkshops->Remove(i);break;}
+    }
+  Session()->RemoveEntity(aworkshop);
+  
+  DumpWorkshopList();
+  return;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : SetWarehouse
+//purpose  : 
+//=======================================================================
+void WOKernel_Factory::SetWarehouse(const Handle(WOKernel_Warehouse)& awarehouse) 
+{
+  if(!awarehouse.IsNull())
+    {
+      mywarehouse = awarehouse->FullName();
+    }
+}
+
+//=======================================================================
+//function : Warehouse
+//purpose  : Returns Handle of Factory Warehouse
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Factory::Warehouse() const 
+{
+  return mywarehouse;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : SetSourceStorage
+//purpose  : 
+//=======================================================================
+void WOKernel_Factory::SetSourceStorage(const Handle(WOKUtils_Path)& apath)
+{
+  mysccsbase = apath;
+}
+
+//=======================================================================
+//function : SourceStorage
+//purpose  : Returns Path of Factory Source repository
+//=======================================================================
+Handle(WOKUtils_Path) WOKernel_Factory::SourceStorage() const 
+{
+  return mysccsbase;
+}
+
diff --git a/src/WOKernel/WOKernel_File.cdl b/src/WOKernel/WOKernel_File.cdl
new file mode 100755 (executable)
index 0000000..faaaecd
--- /dev/null
@@ -0,0 +1,68 @@
+-- File:       WOKernel_File.cdl
+-- Created:    Fri Jun 23 18:40:23 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class File from WOKernel 
+inherits BaseEntity from WOKernel
+
+       ---Purpose: a file in WOK context
+
+uses
+    Entity               from WOKernel,
+    Workbench            from WOKernel,
+    DevUnit              from WOKernel,
+    UnitNesting          from WOKernel,
+    FileType             from WOKernel,
+    HAsciiString         from TCollection,
+    HSequenceOfParamItem from WOKUtils,
+    Path                 from WOKUtils
+raises 
+    ProgramError from Standard
+is
+
+    Create(aname : HAsciiString from TCollection; anesting : Entity from WOKernel; atype : FileType from WOKernel)    
+    ---Purpose: Constructor of a File with a FileDependent Type
+       returns mutable File from WOKernel;
+
+    Create(anesting : Entity from WOKernel; atype : FileType from WOKernel)    
+    ---Purpose: Constructor of a File with a !FileDependent Type
+    --          Warning : Raises if FileType is FileDependent
+       returns mutable File from WOKernel;
+
+    Path(me) 
+    ---C++: return const &
+    ---C++: inline
+               returns Path from WOKUtils;
+
+    SetPath(me:mutable; apath : Path from WOKUtils);
+
+    Type(me)     returns FileType from WOKernel;
+    ---C++: return const &
+    ---C++: inline
+    TypeName(me)
+    ---C++: return const &
+    ---C++: inline
+       returns HAsciiString from TCollection;
+    SetType(me:mutable; atype : FileType from WOKernel);
+
+    GetUniqueName(me) 
+       returns HAsciiString from TCollection is redefined;
+
+    LocatorName(me:mutable)
+    ---C++: return const &
+       returns HAsciiString from TCollection;
+
+    FileLocatorName(myclass; unitname, type, aname : HAsciiString from TCollection)
+       returns HAsciiString from TCollection;
+       
+    GetPath(me:mutable)
+       raises ProgramError from Standard;
+
+fields
+    mytype        : FileType     from WOKernel;
+    mypath        : Path         from WOKUtils;
+    mylocatorname : HAsciiString from TCollection;
+end File;
diff --git a/src/WOKernel/WOKernel_File.cxx b/src/WOKernel/WOKernel_File.cxx
new file mode 100755 (executable)
index 0000000..1487660
--- /dev/null
@@ -0,0 +1,195 @@
+// File:       WOKernel_File.cxx
+// Created:    Wed Jul 26 19:02:37 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <Standard_NullObject.hxx>
+#include <Standard_ConstructionError.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKernel_UnitNesting.hxx>
+#include <WOKernel_Session.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_Workbench.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+
+#include <WOKernel_File.ixx>
+
+//=======================================================================
+//function : WOKernel_File
+//purpose  : 
+//=======================================================================
+WOKernel_File::WOKernel_File(const Handle(TCollection_HAsciiString)& aname, 
+                            const Handle(WOKernel_Entity)& anesting, 
+                            const Handle(WOKernel_FileType)& atype) 
+: WOKernel_BaseEntity(aname, anesting), mytype(atype)
+{
+  myfullname = GetUniqueName();
+}
+
+
+//=======================================================================
+//function : WOKernel_File
+//purpose  : 
+//=======================================================================
+WOKernel_File::WOKernel_File(const Handle(WOKernel_Entity)& anesting, 
+                            const Handle(WOKernel_FileType)& atype) 
+: WOKernel_BaseEntity(Handle(TCollection_HAsciiString)(), anesting), mytype(atype)
+{
+  if(mytype->IsFileDependent())
+    {
+      ErrorMsg << "WOKernel_File::WOKernel_File"
+              << "Tried to build a File with noname with a FileDependant Type (" << mytype->Name() << ")" << endm;
+
+      Standard_ConstructionError::Raise("WOKernel_File::WOKernel_File");
+    }
+
+  Handle(TCollection_HAsciiString) aname = mytype->ComputePath(anesting->Params(),Handle(TCollection_HAsciiString)());
+  if (!aname.IsNull()) {
+    Handle(WOKUtils_Path) apath = new WOKUtils_Path(aname);
+    SetName(apath->FileName());
+  }
+}
+
+
+
+//=======================================================================
+//function : SetPath
+//purpose  : 
+//=======================================================================
+void WOKernel_File::SetPath(const Handle(WOKUtils_Path)& apath)
+{
+  if(apath.IsNull())  Standard_NullObject::Raise("WOKernel_File::SetPath");
+  mypath = apath;
+}
+
+//=======================================================================
+//function : SetType
+//purpose  : 
+//=======================================================================
+void WOKernel_File::SetType(const Handle(WOKernel_FileType)& atype)
+{
+  mypath.Nullify();
+  mytype = atype;
+}
+
+//=======================================================================
+//function : GetUniqueName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_File::GetUniqueName() const
+{
+  Handle(TCollection_HAsciiString) apath = new TCollection_HAsciiString;
+
+  Handle(WOKernel_Entity) nesting = Session()->GetEntity(Nesting());
+
+  if(!nesting.IsNull())
+    {
+      apath->AssignCat(nesting->UserPathName());
+      apath->AssignCat(":");
+      apath->AssignCat(TypeName());
+      if(!Name().IsNull()) 
+       {
+         apath->AssignCat(":");
+         apath->AssignCat(Name());
+       }
+      return apath;
+    }
+  else
+    {
+      apath->AssignCat(TypeName());
+      if(!Name().IsNull()) 
+       {
+         apath->AssignCat(":");
+         apath->AssignCat(Name());
+       }
+      return apath;
+    }
+}
+
+//=======================================================================
+//function : LocatorName
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_File::LocatorName() 
+{
+  
+  if(mylocatorname.IsNull())
+    {
+      Handle(TCollection_HAsciiString) apath = new TCollection_HAsciiString;
+      
+      Handle(WOKernel_Entity) nesting = Handle(WOKernel_DevUnit)::DownCast(Session()->GetEntity(Nesting()));
+      
+      if(!nesting.IsNull())
+       {
+         apath->AssignCat(nesting->Name());
+         apath->AssignCat(":");
+         apath->AssignCat(TypeName());
+         apath->AssignCat(":");
+         apath->AssignCat(Name());
+       }
+      else
+       {
+         apath->AssignCat(TypeName());
+         apath->AssignCat(":");
+         apath->AssignCat(Name());
+       }
+      mylocatorname = apath;
+    }
+  return mylocatorname;
+}
+
+//=======================================================================
+//function : FileLocatorName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_File::FileLocatorName(const Handle(TCollection_HAsciiString)& unitname,
+                                                               const Handle(TCollection_HAsciiString)& type,
+                                                               const Handle(TCollection_HAsciiString)& name) 
+{
+  Handle(TCollection_HAsciiString) apath = new TCollection_HAsciiString;
+  
+  if(!unitname.IsNull())
+    {
+      apath->AssignCat(unitname);
+      apath->AssignCat(":");
+      apath->AssignCat(type);
+      apath->AssignCat(":");
+      apath->AssignCat(name);
+      return apath;
+    }
+  else
+    {
+      apath->AssignCat(type);
+      apath->AssignCat(":");
+      apath->AssignCat(name);
+      return apath;
+    }
+}
+
+//=======================================================================
+//function : GetFilePath
+//purpose  : 
+//=======================================================================
+void WOKernel_File::GetPath() 
+{
+  if(mypath.IsNull())
+    {
+      Handle(WOKernel_FileType)        atype;
+      
+      // D'abord le type de Nesting (DevUnit, UnitNesting)
+      
+      Handle(WOKernel_Entity) anesting = Session()->GetEntity(Nesting());
+      
+      atype = Type();
+      
+      Handle(TCollection_HAsciiString) astr = atype->ComputePath(anesting->Params(), Name());
+      mypath = new WOKUtils_Path(astr);
+    }
+ return;
+}
+
diff --git a/src/WOKernel/WOKernel_File.lxx b/src/WOKernel/WOKernel_File.lxx
new file mode 100755 (executable)
index 0000000..c74985d
--- /dev/null
@@ -0,0 +1,36 @@
+// File:       WOKernel_File.lxx
+// Created:    Tue Aug 22 18:00:01 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKernel_FileType.hxx>
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Path
+//purpose  : 
+//=======================================================================
+const Handle(WOKUtils_Path)& WOKernel_File::Path() const
+{
+  return mypath;
+}
+
+
+//=======================================================================
+//function : Type
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_FileType)& WOKernel_File::Type() const
+{
+  return mytype;
+}
+
+//=======================================================================
+//function : TypeName
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_File::TypeName() const
+{
+  return mytype->Name();
+}
diff --git a/src/WOKernel/WOKernel_FileLocatorHasher.cdl b/src/WOKernel/WOKernel_FileLocatorHasher.cdl
new file mode 100755 (executable)
index 0000000..1644186
--- /dev/null
@@ -0,0 +1,21 @@
+-- File:       WOKernel_FileLocatorHasher.cdl
+-- Created:    Thu Apr 25 21:05:49 1996
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1996
+
+class FileLocatorHasher from WOKernel 
+
+       ---Purpose: 
+
+uses
+    File from WOKernel
+is
+
+    HashCode(myclass; akey : File from WOKernel)
+       returns Integer from Standard;
+       
+    IsEqual(myclass; akey1, akey2: File from WOKernel)
+       returns Boolean from Standard;
+
+end FileLocatorHasher;
diff --git a/src/WOKernel/WOKernel_FileLocatorHasher.cxx b/src/WOKernel/WOKernel_FileLocatorHasher.cxx
new file mode 100755 (executable)
index 0000000..134c755
--- /dev/null
@@ -0,0 +1,32 @@
+// File:       WOKernel_FileLocatorHasher.cxx
+// Created:    Thu Apr 25 21:06:51 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <WOKTools_HAsciiStringHasher.hxx>
+
+#include <WOKernel_File.hxx>
+
+#include <WOKernel_FileLocatorHasher.ixx>
+
+
+//=======================================================================
+//function : HashCode
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKernel_FileLocatorHasher::HashCode(const Handle(WOKernel_File)& akey)
+{
+  return WOKTools_HAsciiStringHasher::HashCode(akey->LocatorName());
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_FileLocatorHasher::IsEqual(const Handle(WOKernel_File)& akey1, const Handle(WOKernel_File)& akey2)
+{
+  if (strcmp(akey1->LocatorName()->ToCString(), akey2->LocatorName()->ToCString()) == 0) return(Standard_True);
+  else                                                                                   return(Standard_False);
+}
diff --git a/src/WOKernel/WOKernel_FileType.cdl b/src/WOKernel/WOKernel_FileType.cdl
new file mode 100755 (executable)
index 0000000..eee573c
--- /dev/null
@@ -0,0 +1,108 @@
+-- File:       WOKernel_FileType.cdl
+-- Created:    Fri Jun 23 18:45:29 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class FileType from WOKernel 
+inherits TShared from MMgt
+
+       ---Purpose: manages the various file types in WOK
+
+uses
+    HAsciiString            from TCollection,
+    Template                from EDL,
+    HSequenceOfDBMSID       from WOKernel,
+    HSequenceOfStationID    from WOKernel,
+    MapOfHAsciiString       from WOKTools,
+    Param                   from WOKUtils,
+    Path                    from WOKUtils,
+    HSequenceOfHAsciiString from TColStd
+raises
+    ProgramError from Standard
+is
+    Create returns mutable FileType from WOKernel;
+    
+    Create(aname     : HAsciiString from TCollection;
+          atemplate : Template     from EDL) 
+       returns mutable FileType from WOKernel;
+    Name(me) 
+    ---C++: inline
+    ---C++: return const &      
+       returns HAsciiString from TCollection;
+    Template(me)
+    ---C++: inline
+    ---C++: return const &      
+       returns Template from EDL;
+       
+    ComputePath(me:mutable; params : Param        from WOKUtils; 
+                afilename : HAsciiString from  TCollection)
+    ---Purpose: Computes a path using a format and parameters    
+    --          Supposes that WOKernel_FileTypeBase::SetNeededArguments
+    --          was called Before use.
+       returns HAsciiString from TCollection;
+
+    GetDefinition(me)
+       returns HAsciiString from TCollection;
+
+    GetArguments(me)
+       returns HSequenceOfHAsciiString from TColStd;
+       
+    GetDependency(me:mutable) raises ProgramError from Standard is private;
+    ---Purpose: calculates Station and DBMS dependency for Type    
+       
+    SetStationDependent(me:mutable);
+    UnSetStationDependent(me:mutable);
+    IsStationDependent(me) returns Boolean from Standard;
+    ---C++: inline
+    
+    SetDBMSDependent(me:mutable);
+    UnSetDBMSDependent(me:mutable);
+    IsDBMSDependent(me) returns Boolean from Standard;
+    ---C++: inline
+    
+    SetNestingDependent(me:mutable);
+    UnSetNestingDependent(me:mutable);
+    IsNestingDependent(me) returns Boolean from Standard;
+    ---C++: inline
+
+    SetEntityDependent(me:mutable);
+    UnSetEntityDependent(me:mutable);
+    IsEntityDependent(me) returns Boolean from Standard;
+    ---C++: inline
+
+    SetFileDependent(me:mutable);
+    UnSetFileDependent(me:mutable);
+    IsFileDependent(me) returns Boolean from Standard;
+    ---C++: inline
+
+    Directory(me:mutable);
+    File(me:mutable);
+    
+    IsFile(me)
+    ---C++: inline
+               returns Boolean from Standard;
+       
+    IsDirectory(me)
+    ---C++: inline
+               returns Boolean from Standard;
+
+    GetDirectory(me:mutable; params : Param from WOKUtils)
+       returns HAsciiString from TCollection;
+       
+    GetFile(me:mutable; params : Param from WOKUtils)
+       returns HAsciiString from TCollection;
+    
+fields
+    myname       : HAsciiString from TCollection;
+    mytemplate   : Template     from EDL;
+    mystationdep : Boolean      from Standard;
+    mydbmsdep    : Boolean      from Standard;
+    mynestingdep : Boolean      from Standard;
+    myentitydep  : Boolean      from Standard;
+    myfiledep    : Boolean      from Standard;
+    myisrep      : Boolean      from Standard;
+end FileType;
diff --git a/src/WOKernel/WOKernel_FileType.cxx b/src/WOKernel/WOKernel_FileType.cxx
new file mode 100755 (executable)
index 0000000..d781a14
--- /dev/null
@@ -0,0 +1,259 @@
+// File:       WOKernel_FileType.cxx
+// Created:    Wed Jun 28 17:32:21 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+#include <EDL_API.hxx>
+#include <EDL_Template.hxx>
+#include <EDL_HSequenceOfVariable.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Param.hxx>
+
+
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_FileTypeKeyWords.hxx>
+
+#include <WOKernel_FileType.ixx>
+
+
+//=======================================================================
+//function : WOKernel_FileType
+//purpose  : instantiates an Empty File Type
+//=======================================================================
+WOKernel_FileType::WOKernel_FileType() 
+  : mystationdep(Standard_False), mydbmsdep(Standard_False), mynestingdep(Standard_False), 
+    myentitydep(Standard_False), myfiledep(Standard_False), myisrep(Standard_False)
+{
+}
+
+//=======================================================================
+//function : WOKernel_FileType
+//purpose  : intantiates a file types
+//=======================================================================
+WOKernel_FileType::WOKernel_FileType(const Handle(TCollection_HAsciiString)& aname,
+                                    const EDL_Template& atemplate)
+  : myname(aname), mytemplate(atemplate),
+    mystationdep(Standard_False), mydbmsdep(Standard_False), mynestingdep(Standard_False), 
+    myentitydep(Standard_False), myfiledep(Standard_False), myisrep(Standard_False)
+{
+  GetDependency();
+}
+
+
+//=======================================================================
+//function : ComputePath
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_FileType::ComputePath(const WOKUtils_Param& params,
+                                                               const Handle(TCollection_HAsciiString)& afilename) 
+{
+  Handle(TCollection_HAsciiString) result;
+  Handle(EDL_HSequenceOfVariable)  vars = new EDL_HSequenceOfVariable;
+
+  if(IsFileDependent() && !afilename.IsNull())
+    params.Set((Standard_CString) FILEVAR, afilename->ToCString());
+
+  Handle(TColStd_HSequenceOfHAsciiString) needed = mytemplate.GetVariableList();
+
+  for(Standard_Integer i=1; i<=needed->Length(); i++)
+    {
+      const Standard_CString name = needed->Value(i)->ToCString();
+      if(params.myapi->IsDefined(name))
+       {
+         vars->Append(params.myapi->GetVariable(name));
+       }
+      else
+       {
+         ErrorMsg << "WOKernel_FileType::ComputePath"
+                  << "Needed argument " << name << " for type " << Name() << " is not setted" << endm;
+         return result;
+       }
+    }
+
+  mytemplate.Eval(vars);
+
+  Handle(TColStd_HSequenceOfAsciiString) resseq = mytemplate.GetEval();
+
+  if(resseq.IsNull())
+    {
+      ErrorMsg << "WOKernel_FileType::ComputePath"
+              << "Type " << Name() << " could not be evaluated" << endm;
+    }
+  else
+    {
+      if(resseq->Length() != 1)
+       {
+         WarningMsg << "WOKernel_FileType::ComputePath"
+           << "Type " << Name() << " evaluates to more than one line : ignoring others" << endm;
+       }
+      result=new TCollection_HAsciiString(resseq->Value(1));
+    }
+  return result;
+}
+
+//=======================================================================
+//function : GetDefinition
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_FileType::GetDefinition() const
+{
+  return new TCollection_HAsciiString(Template().GetLine(1));
+}
+
+//=======================================================================
+//function : GetArguments
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_FileType::GetArguments() const
+{
+  return Template().GetVariableList();
+}
+
+//=======================================================================
+//function : GetDependency
+//purpose  : 
+//=======================================================================
+void WOKernel_FileType::GetDependency()
+{
+  Standard_Integer i;
+  static Standard_Integer nestlen = strlen(NESTING_PREFIX);
+  static Standard_Integer entlen  = strlen(ENTITY_PREFIX);
+  Standard_CString astr;
+
+  Handle(TColStd_HSequenceOfHAsciiString) aseq = mytemplate.GetVariableList();
+  
+  UnSetStationDependent();
+  UnSetDBMSDependent();
+  UnSetNestingDependent();
+  UnSetEntityDependent();
+  UnSetFileDependent();
+
+  for(i=1; i<=aseq->Length(); i++)
+    {
+      astr = aseq->Value(i)->ToCString();
+      if(!strncmp(astr, NESTING_PREFIX, nestlen))
+       {
+         SetNestingDependent();
+         if(!strcmp(astr, NESTING_STATION))   SetStationDependent();
+         else if(!strcmp(astr, NESTING_DBMS)) SetDBMSDependent();
+         else if(!strcmp(astr, NESTING_DBMS_STATION)) {SetDBMSDependent();SetStationDependent();}
+       }
+      else if(!strncmp(astr, ENTITY_PREFIX, entlen))
+       {
+         SetEntityDependent();
+         if(!strcmp(astr, ENTITY_STATION))   SetStationDependent();
+         else if(!strcmp(astr, ENTITY_DBMS)) SetDBMSDependent();
+         else if(!strcmp(astr, ENTITY_DBMS_STATION)) {SetDBMSDependent();SetStationDependent();}
+       }
+      else
+       {
+         if(!strcmp(astr, STATIONVAR))      SetStationDependent();
+         else if(!strcmp(astr, DBMSVAR))    SetDBMSDependent();
+         else if(!strcmp(astr, ENTITYVAR))  SetEntityDependent();
+         else if(!strcmp(astr, NESTINGVAR)) SetNestingDependent();
+         else if(!strcmp(astr, FILEVAR))    SetFileDependent();
+       }
+    }
+  return;
+}
+
+//=======================================================================
+//function : Station Dependency
+//purpose  : 
+//=======================================================================
+void WOKernel_FileType::SetStationDependent()   {mystationdep = Standard_True;}
+void WOKernel_FileType::UnSetStationDependent() {mystationdep = Standard_False;}
+
+//=======================================================================
+//function : DBMS Dependency
+//purpose  : 
+//=======================================================================
+void WOKernel_FileType::SetDBMSDependent()      {mydbmsdep = Standard_True;}
+void WOKernel_FileType::UnSetDBMSDependent()    {mydbmsdep = Standard_False;}
+
+//=======================================================================
+//function : Nesting Dependency
+//purpose  : 
+//=======================================================================
+void WOKernel_FileType::SetNestingDependent()   {mynestingdep = Standard_True;}
+void WOKernel_FileType::UnSetNestingDependent() {mynestingdep = Standard_False;}
+
+//=======================================================================
+//function : Unit Dependency
+//purpose  : 
+//=======================================================================
+void WOKernel_FileType::SetEntityDependent()      {myentitydep = Standard_True;}
+void WOKernel_FileType::UnSetEntityDependent()    {myentitydep = Standard_False;}
+
+//=======================================================================
+//function : File Dependency
+//purpose  : 
+//=======================================================================
+void WOKernel_FileType::SetFileDependent()      {myfiledep = Standard_True;}
+void WOKernel_FileType::UnSetFileDependent()    {myfiledep = Standard_False;}
+
+
+
+//=======================================================================
+//function : Directory
+//purpose  : 
+//=======================================================================
+void WOKernel_FileType::Directory() {myisrep = Standard_True; }
+void WOKernel_FileType::File()      {myisrep = Standard_False;}
+
+//=======================================================================
+//function : GetDirectory
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_FileType::GetDirectory(const WOKUtils_Param& params) 
+{
+  Standard_Integer apos;
+  Handle(TCollection_HAsciiString) result, nullHandle, apath, dollars = new TCollection_HAsciiString("$$$$$$$$$$$$$$$$$$");
+
+  if(IsDirectory() && !IsFileDependent())
+    {
+      result = ComputePath(params, nullHandle); 
+      return result;
+    }
+
+  apath = ComputePath(params, dollars);
+  apos = apath->Location(dollars, 1, apath->Length());
+  
+  if(apos != 0)
+    {
+      apath = apath->SubString(1, apos);
+    }
+
+  apos = apath->SearchFromEnd("/");
+
+  if(apos != -1)
+    {
+      apath = apath->SubString(1, apos-1);
+    }
+  else apath.Nullify();
+
+  return apath;
+}
+
+//=======================================================================
+//function : GetFile
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_FileType::GetFile(const WOKUtils_Param& params) 
+{
+  Handle(TCollection_HAsciiString) result, nullHandle, apath, dollars = new TCollection_HAsciiString("$$$$$$$$$$$$$$$$$$");
+
+  if(IsFile() && !IsFileDependent())
+    {
+      result = ComputePath(params, nullHandle);
+    }
+  return result;
+}
diff --git a/src/WOKernel/WOKernel_FileType.lxx b/src/WOKernel/WOKernel_FileType.lxx
new file mode 100755 (executable)
index 0000000..48256be
--- /dev/null
@@ -0,0 +1,59 @@
+// File:       WOKernel_FileType.lxx
+// Created:    Fri Jul 28 18:10:24 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+//=======================================================================
+//function : Name
+//purpose  : 
+//=======================================================================
+const Handle(TCollection_HAsciiString)& WOKernel_FileType::Name() const
+{
+  return myname;
+}
+
+//=======================================================================
+//function : Template
+//purpose  : gives the format for workbench path solver
+//=======================================================================
+const EDL_Template& WOKernel_FileType::Template() const 
+{
+  return mytemplate;
+}
+
+
+Standard_Boolean WOKernel_FileType::IsStationDependent() const 
+{
+  return mystationdep;
+}
+
+Standard_Boolean WOKernel_FileType::IsDBMSDependent() const 
+{
+  return mydbmsdep;
+}
+
+Standard_Boolean WOKernel_FileType::IsEntityDependent() const 
+{
+  return myentitydep;
+}
+
+Standard_Boolean WOKernel_FileType::IsNestingDependent() const 
+{
+  return mynestingdep;
+}
+
+Standard_Boolean WOKernel_FileType::IsFileDependent() const 
+{
+  return myfiledep;
+}
+
+Standard_Boolean WOKernel_FileType::IsDirectory() const
+{
+  return myisrep;
+}
+
+Standard_Boolean WOKernel_FileType::IsFile() const
+{
+  return !myisrep;
+}
diff --git a/src/WOKernel/WOKernel_FileTypeBase.cdl b/src/WOKernel/WOKernel_FileTypeBase.cdl
new file mode 100755 (executable)
index 0000000..7a233d3
--- /dev/null
@@ -0,0 +1,113 @@
+-- File:       WOKernel_FileTypeBase.cdl
+-- Created:    Fri Jun 23 18:53:21 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class FileTypeBase from WOKernel 
+inherits TShared   from MMgt
+
+       ---Purpose: using  a map to  store the various file types known
+       --          by WOK
+
+uses
+    Entity                   from WOKernel,
+    FileType                 from WOKernel,
+    DataMapOfFileType        from WOKernel,
+    DBMSID                   from WOKernel,
+    HSequenceOfDBMSID        from WOKernel,
+    StationID                from WOKernel,
+    HSequenceOfStationID     from WOKernel,
+    FileTypeIterator         from WOKernel,
+    Path                     from WOKUtils,
+    Param                    from WOKUtils,
+    HAsciiString             from TCollection,
+    HSequenceOfHAsciiString  from TColStd
+
+is
+
+    Create returns mutable FileTypeBase from WOKernel;
+    ---Purpose: instantiates the file type base    
+    
+    Load(me:mutable; parms : Param from WOKUtils);
+    ---Purpose: loads the WOK file types from a file    
+
+    SetParams(me:mutable; parms : Param from WOKUtils);
+    ---Purpose: Sets Parameters    
+
+    IsType(me; atype : HAsciiString from TCollection)
+    ---Purpose: returns True if type is defined, False otherwise   
+       returns Boolean from Standard;
+       
+    IsType(me; atype : CString     from Standard)
+    ---Purpose: returns True if type is defined, False otherwise      
+       returns Boolean from Standard;
+       
+    Type(me; atype : HAsciiString from TCollection) 
+    ---Purpose: returns the file type if known in the map    
+       returns FileType from WOKernel;
+       
+    Type(me; atype : CString     from Standard)
+    ---Purpose: returns the file type if known in the map  
+       returns FileType from WOKernel;
+
+    TypeName(me; atype : FileType from WOKernel)
+       returns HAsciiString from TCollection;
+
+    GetNeededArguments(me:mutable; params : Param from WOKUtils) 
+    ---Purpose: Gets (calculates the list of templates args    
+       returns HSequenceOfHAsciiString from TColStd;
+
+    GetNeededParameters(me:mutable;   entity : HAsciiString         from TCollection;
+                                   anesting : HAsciiString         from TCollection;
+                                      dbmss : HSequenceOfDBMSID    from WOKernel; 
+                                   stations : HSequenceOfStationID from WOKernel) 
+    ---Purpose: Returns the list of needed parameters in a particular context    
+       returns HSequenceOfHAsciiString from TColStd;
+
+    NeededArguments(me)
+    ---Purpose: Returns the list of needed template arguments
+       returns HSequenceOfHAsciiString from TColStd;
+
+    SetNeededArguments(me; entity : Entity       from WOKernel;
+                           adbms : DBMSID       from WOKernel; 
+                        astation : StationID    from WOKernel);
+    ---Purpose: Sets Parameters used by templates for a particular Context    
+    --          
+    
+    GetDirectories(me; entity : Entity from WOKernel;
+                                dbmss : HSequenceOfDBMSID    from WOKernel; 
+                             stations : HSequenceOfStationID from WOKernel;
+                            hasentity : Boolean from Standard ) 
+       returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: Calculates All Directories possibilities for a FileTypeBase in a Context.    
+    --          
+    GetDirectories(me; Theentity : Entity from WOKernel;
+                         dbmss : HSequenceOfDBMSID    from WOKernel; 
+                      stations : HSequenceOfStationID from WOKernel;
+                 getNestingdir : Boolean              from Standard;  
+                  getEntitydir : Boolean              from Standard; 
+         getNestingAndEntitydir : Boolean              from Standard;     
+                    getDbmsdir : Boolean              from Standard;  
+                getStationsdir : Boolean              from Standard;  
+         getStationsAndDbmsdir : Boolean              from Standard;
+             getIndependentdir : Boolean              from Standard)  
+       returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: Calculates All Directories possibilities for a FileTypeBase in a Context.    
+
+    GetFiles(me; theentity : Entity from WOKernel;
+                                dbmss : HSequenceOfDBMSID    from WOKernel; 
+                             stations : HSequenceOfStationID from WOKernel;
+                            hasentity : Boolean from Standard) 
+       returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: Calculates All Files possibilities for a FileTypeBase in a Context.    
+    --          
+
+    TypeIterator(me)
+       returns FileTypeIterator from WOKernel;
+
+fields
+    mytypes      : DataMapOfFileType       from WOKernel;    
+    myneededargs : HSequenceOfHAsciiString from TColStd;
+end FileTypeBase;
diff --git a/src/WOKernel/WOKernel_FileTypeBase.cxx b/src/WOKernel/WOKernel_FileTypeBase.cxx
new file mode 100755 (executable)
index 0000000..2af4481
--- /dev/null
@@ -0,0 +1,1203 @@
+// File:       WOKernel_FileTypeBase.cxx
+// Created:    Wed Feb 28 23:20:18 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+#include <EDL_API.hxx>
+
+#include <WOKTools_MapOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_AdmFile.hxx>
+
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DataMapIteratorOfDataMapOfFileType.hxx>
+#include <WOKernel_FileTypeKeyWords.hxx>
+#include <WOKernel_SequenceOfFileType.hxx>
+#include <WOKernel_Array1OfHSequenceOfHAsciiString.hxx>
+#include <WOKernel_Session.hxx>
+
+#include <WOKernel_FileTypeBase.ixx>
+
+
+
+//=======================================================================
+//function : WOKernel_FileTypeBase
+//purpose  : 
+//=======================================================================
+WOKernel_FileTypeBase::WOKernel_FileTypeBase()
+{
+}
+
+//=======================================================================
+//function : Load
+//purpose  : 
+//=======================================================================
+void WOKernel_FileTypeBase::Load(const WOKUtils_Param& params)
+{
+  Handle(TCollection_HAsciiString) astr, thestr, templname;
+  Handle(WOKernel_FileType)        thetype;
+  Standard_Integer i=1;
+
+  astr =  params.Eval((Standard_CString) WOKENTITYFILELIST, Standard_False);
+  
+  if(astr.IsNull())
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::Load"
+       << "Could not evalutate parameter " << (Standard_CString) WOKENTITYFILELIST << endm;
+      return;
+    }
+
+  if( !astr->IsEmpty())
+    {
+      thestr = astr->Token(" \t", i++);
+      
+      while(!thestr->IsEmpty())
+       {
+         
+         if(mytypes.IsBound(thestr))
+           {
+             WarningMsg << "WOKernel_FileTypeBase::Load" 
+                        << "Redefinition of type " << thestr << endm;
+           }
+         else
+           {
+             templname = new TCollection_HAsciiString((Standard_CString) WOKENTITY);
+             templname->AssignCat("_");
+             templname->AssignCat(thestr);
+             
+             if(!params.myapi->IsDefined(templname->ToCString()))
+               {
+                 ErrorMsg << "WOKernel_FileTypeBase::Load" 
+                          << "Listed type " << thestr << " is not defined (" << templname << ")" << endm;
+               }
+             else
+               {
+                 thetype = new WOKernel_FileType(thestr, params.myapi->GetTemplate(templname->ToCString()));
+                 thetype->File();
+                 mytypes.Bind(thestr, thetype);
+               }
+           }
+         
+         thestr = astr->Token(" \t", i++);
+       }
+      
+    }
+
+  astr =  params.Eval((Standard_CString) WOKENTITYDIRLIST, Standard_False);
+  i=1;
+  
+  if( !astr->IsEmpty())
+    {
+      thestr = astr->Token(" \t", i++);
+      
+      while(!thestr->IsEmpty())
+       {
+         
+         if(mytypes.IsBound(thestr))
+           {
+             WarningMsg << "WOKernel_FileTypeBase::Load" 
+                        << "Redefinition of type " << thestr << endm;
+           }
+         else
+           {
+             templname = new TCollection_HAsciiString((Standard_CString) WOKENTITY);
+             templname->AssignCat("_");
+             templname->AssignCat(thestr);
+             
+             if(!params.myapi->IsDefined(templname->ToCString()))
+               {
+                 ErrorMsg << "WOKernel_FileTypeBase::Load" 
+                          << "Listed type " << thestr << " is not defined (" << templname << ")" << endm;
+               }
+             else
+               {
+                 thetype = new WOKernel_FileType(thestr, params.myapi->GetTemplate(templname->ToCString()));
+                 thetype->Directory();
+                 mytypes.Bind(thestr, thetype);
+               }
+           }
+         
+         thestr = astr->Token(" \t", i++);
+       }
+    }
+  myneededargs = GetNeededArguments(params);
+  return;
+}
+
+//=======================================================================
+//function : IsType
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_FileTypeBase::IsType(const Handle(TCollection_HAsciiString)& atype) const 
+{
+  if(mytypes.IsBound(atype))
+    return Standard_True;
+  else
+    return Standard_False;
+}
+
+//=======================================================================
+//function : IsType
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_FileTypeBase::IsType(const Standard_CString atype) const 
+{
+  Handle(WOKernel_FileType) result;
+  Handle(TCollection_HAsciiString) name;
+
+  name = new TCollection_HAsciiString(atype);
+
+  if(mytypes.IsBound(name))
+    return Standard_True;
+  else
+    return Standard_False;
+}
+
+//=======================================================================
+//function : Type
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_FileType) WOKernel_FileTypeBase::Type(const Handle(TCollection_HAsciiString)& atype) const 
+{
+  Handle(WOKernel_FileType) result;
+
+  if(mytypes.IsBound(atype))
+    result = mytypes.Find(atype);
+  else
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::Type" 
+              << "Attempt to get inexistent type : " << atype << endm;
+    }
+  return result;
+}
+
+//=======================================================================
+//function : Type
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_FileType) WOKernel_FileTypeBase::Type(const Standard_CString atype) const 
+{
+  Handle(WOKernel_FileType) result;
+  Handle(TCollection_HAsciiString) name;
+
+  name = new TCollection_HAsciiString(atype);
+
+  if(mytypes.IsBound(name))
+    result = mytypes.Find(name);
+  else
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::Type" 
+              << "Attempt to get inexistent type : " << atype << endm;
+    }
+  return result;
+}
+
+//=======================================================================
+//function : TypeName
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_FileTypeBase::TypeName(const Handle(WOKernel_FileType)& atype) const 
+{
+  return atype->Name();
+}
+
+//=======================================================================
+//function : GetNeededArguments
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_FileTypeBase::GetNeededArguments(const WOKUtils_Param& params) 
+{
+  Handle(TColStd_HSequenceOfHAsciiString) asubseq = new TColStd_HSequenceOfHAsciiString;
+  Handle(TCollection_HAsciiString) astr, thestr;
+
+  WOKernel_DataMapIteratorOfDataMapOfFileType anit(mytypes);
+  WOKTools_MapOfHAsciiString                  amap;
+  
+  while(anit.More() == Standard_True)
+    {
+      params.GetArguments(anit.Value()->Template().GetName(), asubseq, amap);
+      anit.Next();
+    }
+
+  astr =  params.Eval((Standard_CString) WOKENTITYPARAMLIST, Standard_False);
+  
+  Standard_Integer i=1;
+  if( !astr->IsEmpty())
+    {
+      thestr = astr->Token(" \t", i++);
+
+      while(!thestr->IsEmpty())
+       {
+         if(!amap.Contains(thestr))    {asubseq->Append(thestr);amap.Add(thestr);}
+         thestr = astr->Token(" \t", i++);
+       }      
+    }
+  
+  if(params.IsSet((Standard_CString) WOKENTITYBEFOREBUID))
+    params.GetArguments((Standard_CString) WOKENTITYBEFOREBUID, asubseq, amap);
+  
+  if(params.IsSet((Standard_CString) WOKENTITYAFTERBUILD))
+    params.GetArguments((Standard_CString) WOKENTITYAFTERBUILD, asubseq, amap);
+  
+  if(params.IsSet((Standard_CString) WOKENTITYBEFOREDESTROY))
+    params.GetArguments((Standard_CString) WOKENTITYBEFOREDESTROY, asubseq, amap);
+  
+  if(params.IsSet((Standard_CString) WOKENTITYAFTERDESTROY))
+    params.GetArguments((Standard_CString) WOKENTITYAFTERDESTROY, asubseq, amap);
+  
+  myneededargs = asubseq;
+  return asubseq;
+}
+
+//=======================================================================
+//function : GetNeededParameters
+//purpose  : Obtain from FileTypeBase the list of required arguments
+//           if nesting is Null Nesting arguments are ommitted
+//           idem for entity
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_FileTypeBase::GetNeededParameters(const Handle(TCollection_HAsciiString)&      nesting,
+                                                                                  const Handle(TCollection_HAsciiString)&      entity,
+                                                                                  const Handle(WOKernel_HSequenceOfDBMSID)&    dbmss,
+                                                                                  const Handle(WOKernel_HSequenceOfStationID)& stations)
+
+{
+  Standard_Integer i,j, k, apos;
+  Handle(TColStd_HSequenceOfHAsciiString)     aseq    = new TColStd_HSequenceOfHAsciiString;
+  Handle(TColStd_HSequenceOfHAsciiString)     asubseq;
+  Handle(TCollection_HAsciiString)            astr, aname, thestr;
+  WOKTools_MapOfHAsciiString                  amap;
+
+  asubseq = myneededargs;
+  for(i=1; i<=asubseq->Length(); i++)
+    {
+      astr = asubseq->Value(i);
+      
+      if((apos = astr->Search((Standard_CString)NESTING_PREFIX)) != -1)
+       {
+         if(!nesting.IsNull())
+           {
+             thestr = new TCollection_HAsciiString("%");
+             thestr->AssignCat(nesting);
+             thestr->AssignCat("_");
+
+             if(!strcmp(astr->ToCString(), NESTING_STATION))
+               {
+                 for(j=1; j<=stations->Length(); j++)
+                   {
+                     thestr = new TCollection_HAsciiString("%");
+                     thestr->AssignCat(nesting);
+                     thestr->AssignCat("_");
+                     thestr->AssignCat(WOKernel_Station::GetName(stations->Value(j)));
+                     if(!amap.Contains(thestr)) {aseq->Append(thestr);amap.Add(thestr);}
+                   }
+               }
+             else if(!strcmp(astr->ToCString(),NESTING_DBMS))
+               {
+                 for(j=1; j<=dbmss->Length(); j++)
+                   {
+                     thestr = new TCollection_HAsciiString("%");
+                     thestr->AssignCat(nesting);
+                     thestr->AssignCat("_");
+                     thestr->AssignCat(WOKernel_DBMSystem::GetName(dbmss->Value(j)));
+                     if(!amap.Contains(thestr)) {aseq->Append(thestr);amap.Add(thestr);}
+                   }         
+               }
+             else if(!strcmp(astr->ToCString(),NESTING_DBMS_STATION))
+               {
+                 for(j=1; j<=dbmss->Length(); j++)
+                   {
+                     for(k=1; k<=stations->Length(); k++)
+                       {
+                         thestr = new TCollection_HAsciiString("%");
+                         thestr->AssignCat(nesting);
+                         thestr->AssignCat("_");
+                         thestr->AssignCat(WOKernel_DBMSystem::GetName(dbmss->Value(j)));
+                         thestr->AssignCat("_");
+                         thestr->AssignCat(WOKernel_Station::GetName(stations->Value(k)));
+                         if(!amap.Contains(thestr))    {aseq->Append(thestr);amap.Add(thestr);}
+                       }
+                   }
+               }
+             else
+               {
+                 aname = new TCollection_HAsciiString(astr);
+                 aname->Remove(1, strlen(NESTING_PREFIX));
+                 thestr->AssignCat(aname);
+                 if(!amap.Contains(thestr))    {aseq->Append(thestr);amap.Add(thestr);}
+               }
+           }
+       }
+      else if((apos = astr->Search((Standard_CString)ENTITY_PREFIX)) != -1)
+       {
+         if(!entity.IsNull())
+           {
+             thestr = new TCollection_HAsciiString("%");
+             thestr->AssignCat(entity);
+             thestr->AssignCat("_");
+             
+             if(!strcmp(astr->ToCString(), ENTITY_STATION))
+               {
+                 for(j=1; j<=stations->Length(); j++)
+                   {
+                     thestr = new TCollection_HAsciiString("%");
+                     thestr->AssignCat(entity);
+                     thestr->AssignCat("_");
+                     thestr->AssignCat(WOKernel_Station::GetName(stations->Value(j)));
+                     if(!amap.Contains(thestr))        {aseq->Append(thestr);amap.Add(thestr);}
+                   }
+               }
+             else if(!strcmp(astr->ToCString(),ENTITY_DBMS))
+               {
+                 for(j=1; j<=dbmss->Length(); j++)
+                   {
+                     thestr = new TCollection_HAsciiString("%");
+                     thestr->AssignCat(entity);
+                     thestr->AssignCat("_");
+                     thestr->AssignCat(WOKernel_DBMSystem::GetName(dbmss->Value(j)));
+                     if(!amap.Contains(thestr))        {aseq->Append(thestr);amap.Add(thestr);}
+                   }
+               }
+             else if(!strcmp(astr->ToCString(),ENTITY_DBMS_STATION))
+               {
+                 for(j=1; j<=dbmss->Length(); j++)
+                   {
+                     for(k=1; k<=stations->Length(); k++)
+                       {
+                         thestr = new TCollection_HAsciiString("%");
+                         thestr->AssignCat(entity);
+                         thestr->AssignCat("_");
+                         thestr->AssignCat(WOKernel_DBMSystem::GetName(dbmss->Value(j)));
+                         thestr->AssignCat("_");
+                         thestr->AssignCat(WOKernel_Station::GetName(stations->Value(k)));
+                         if(!amap.Contains(thestr))    {aseq->Append(thestr);amap.Add(thestr);}
+                       }
+                   }
+               }
+             else
+               {
+                 aname = new TCollection_HAsciiString(astr);
+                 aname->Remove(1, strlen(ENTITY_PREFIX));
+                 thestr->AssignCat(aname);
+                 if(!amap.Contains(thestr))    {aseq->Append(thestr);amap.Add(thestr);}
+               }
+           }
+       }
+      else
+       {
+         if( strcmp(astr->ToCString(), STATIONVAR) &&
+             strcmp(astr->ToCString(), DBMSVAR)    &&
+             strcmp(astr->ToCString(), NESTINGVAR) &&
+             strcmp(astr->ToCString(), ENTITYVAR)  &&
+             strcmp(astr->ToCString(), FILEVAR)  )
+           {
+             if(!amap.Contains(thestr))        {aseq->Append(thestr);amap.Add(thestr);}
+           }
+       }
+    }
+  return aseq; 
+}
+
+//=======================================================================
+//function : NeededArguments
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_FileTypeBase::NeededArguments() const
+{
+  return myneededargs;
+}
+
+//=======================================================================
+//function : SetNeededArguments
+//purpose  : 
+//=======================================================================
+void WOKernel_FileTypeBase::SetNeededArguments(const Handle(WOKernel_Entity)& theentity,
+                                              const WOKernel_DBMSID          adbms,
+                                              const WOKernel_StationID       astation) const
+{
+  Standard_Integer i;
+  const Standard_Integer nestlen = strlen(NESTING_PREFIX);
+  const Standard_Integer  entlen = strlen(ENTITY_PREFIX);
+  TCollection_AsciiString astr;
+  Handle(TCollection_HAsciiString) anesting;
+  Handle(TCollection_HAsciiString) entity;
+  Handle(TCollection_HAsciiString) value;
+  Handle(WOKernel_Entity)          thenesting;
+  Standard_CString needed;
+  Standard_CString toset;
+  
+  if(theentity.IsNull()) return;
+
+  entity = theentity->Name();
+  
+  if(!theentity->Nesting().IsNull())
+    {
+      thenesting = theentity->Session()->GetEntity(theentity->Nesting());
+      
+      if(!thenesting.IsNull())
+       {
+         anesting = thenesting->Name();
+       }
+    }
+
+  for(i=1; i<=myneededargs->Length(); i++)
+    {
+      Standard_Boolean matched = Standard_False;
+      needed = myneededargs->Value(i)->ToCString();
+
+      if(!thenesting.IsNull())
+       {
+         if(!strncmp(needed, NESTING_PREFIX, nestlen))
+           {
+             matched = Standard_True;
+             astr.Clear();
+             astr.AssignCat("%");
+             astr.AssignCat(anesting->ToCString());
+             astr.AssignCat("_");
+             
+             if(!strcmp(needed, NESTING_STATION))
+               {
+                 // parameter %Nesting_Station needed
+                 astr.AssignCat(WOKernel_Station::GetName(astation)->ToCString());
+                 toset = (Standard_CString) NESTING_STATION;
+                 
+               }
+             else if(!strcmp(needed, NESTING_DBMS))
+               {
+                 // parameter %Nesting_DBMS needed
+                 astr.AssignCat(WOKernel_DBMSystem::GetName(adbms)->ToCString());
+                 toset = (Standard_CString) NESTING_DBMS;
+               }
+             else if(!strcmp(needed, NESTING_DBMS_STATION))
+               {
+                 // parameter %Nesting_DBMS_STATION needed
+                 astr.AssignCat(WOKernel_DBMSystem::GetName(adbms)->ToCString());
+                 astr.AssignCat("_");
+                 astr.AssignCat(WOKernel_Station::GetName(astation)->ToCString());
+                 toset = (Standard_CString) NESTING_DBMS_STATION;
+               }
+             else
+               {
+                 // parameter %Nesting_?????? needed
+                 TCollection_AsciiString suffix(needed);
+                 Standard_Integer pos = suffix.Location(1, '_', 1, suffix.Length());
+                 
+                 if(pos>2)
+                   {
+                     suffix = suffix.Split(pos);
+                   }
+                 astr.AssignCat(suffix);
+                 
+                 toset = needed;
+               }
+             
+         
+             value = thenesting->Params().Eval(astr.ToCString(), Standard_False);
+             if(value.IsNull())
+               {
+                 ErrorMsg << "WOKernel_FileTypeBase::SetNeededArguments"
+                   << "Needed parameter : " << astr.ToCString() << " not setted" << endm;
+               }
+             else
+               {
+                 theentity->Params().Set(toset, value->ToCString());
+               }
+           }
+       }
+      if(!matched)
+       {
+         if(!strncmp(needed, ENTITY_PREFIX, entlen))
+           {
+             matched = Standard_True;
+             astr.Clear();
+             astr.AssignCat("%");
+             astr.AssignCat(entity->ToCString());
+             astr.AssignCat("_");
+             
+             if(!strcmp(needed, ENTITY_STATION))
+               {
+                 // parameter %ENTITY_Station needed
+                 astr.AssignCat(WOKernel_Station::GetName(astation)->ToCString());
+                 toset = (Standard_CString) ENTITY_STATION;
+                 
+               }
+             else if(!strcmp(needed, ENTITY_DBMS))
+               {
+                 // parameter %ENTITY_DBMS needed
+                 astr.AssignCat(WOKernel_DBMSystem::GetName(adbms)->ToCString());
+                 toset = (Standard_CString) ENTITY_DBMS;
+               }
+             else if(!strcmp(needed, ENTITY_DBMS_STATION))
+               {
+                 // parameter %ENTITY_DBMS_STATION needed
+                 astr.AssignCat(WOKernel_DBMSystem::GetName(adbms)->ToCString());
+                 astr.AssignCat("_");
+                 astr.AssignCat(WOKernel_Station::GetName(astation)->ToCString());
+                 toset = (Standard_CString) ENTITY_DBMS_STATION;
+               }
+             else
+               {
+                 // parameter %ENTITY_?????? needed
+                 TCollection_AsciiString suffix(needed);
+                 Standard_Integer pos = suffix.Location(1, '_', 1, suffix.Length());
+                 
+                 if(pos>2)
+                   {
+                     suffix = suffix.Split(pos);
+                   }
+                 astr.AssignCat(suffix);
+                 
+                 toset = needed;
+               }
+             
+             
+             value = theentity->Params().Eval(astr.ToCString(), Standard_False);
+             if(value.IsNull())
+               {
+                 ErrorMsg << "WOKernel_FileTypeBase::SetNeededArguments"
+                   << "Needed parameter : " << astr.ToCString() << " not setted" << endm;
+               }
+             else
+               {
+                 theentity->Params().Set(toset, value->ToCString());
+               }
+           }
+       }
+      if(!matched)
+       {
+         if(!strcmp(needed, STATIONVAR))
+           {
+             theentity->Params().Set((Standard_CString) STATIONVAR, WOKernel_Station::GetName(astation)->ToCString());
+           }
+         else if(!strcmp(needed, DBMSVAR))
+           {
+             theentity->Params().Set((Standard_CString) DBMSVAR,  WOKernel_DBMSystem::GetName(adbms)->ToCString());
+           }
+         else if(!strcmp(needed, ENTITYVAR))
+           {
+             theentity->Params().Set((Standard_CString) ENTITYVAR, entity->ToCString());
+           }
+         else if(!strcmp(needed, NESTINGVAR))
+           {
+             theentity->Params().Set((Standard_CString) NESTINGVAR, anesting->ToCString());
+           }
+       }
+    }
+}
+
+//=======================================================================
+//function : GetDirectories
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) 
+  WOKernel_FileTypeBase::GetDirectories(const Handle(WOKernel_Entity)& Theentity,
+                                       const Handle(WOKernel_HSequenceOfDBMSID)& dbmss,
+                                       const Handle(WOKernel_HSequenceOfStationID)& stations,
+                                       const Standard_Boolean hasentity)
+  const
+{
+  WOKTools_MapOfHAsciiString amap;
+  Standard_Integer i,j, k;
+  Handle(TCollection_HAsciiString) dollars = new TCollection_HAsciiString("$$$$$$$$$$$$$$$$$");
+  Handle(TCollection_HAsciiString) theunit, thenesting, apath;
+  Handle(TColStd_HSequenceOfHAsciiString) result;
+  Handle(WOKernel_FileType) thetype;
+
+  if(Theentity.IsNull()) return result;
+
+  WOKernel_SequenceOfFileType  nothingdep, stationdep, dbmsdep, bothdep;
+
+  Handle(TCollection_HAsciiString) anesting, aunit = Theentity->Name();
+  Handle(WOKernel_Entity)          nesting;
+
+  if(!Theentity->Nesting().IsNull())
+    {
+      nesting = Theentity->Session()->GetEntity(Theentity->Nesting());
+      
+      if(!nesting.IsNull())
+       {
+         anesting = nesting->Name();
+       }
+    }
+
+  if(anesting.IsNull()) thenesting = dollars;
+  else                  thenesting = anesting;
+
+  if(aunit.IsNull()) theunit = dollars;
+  else               theunit = aunit;
+  
+
+  if(!dbmss->Length())
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::GetDirectories" 
+              << "Valid DBMS systems can't be empty." << endm;
+      return result;
+    }
+  
+  if(!stations->Length())
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::GetDirectories" 
+              << "Valid Stations can't be empty." << endm;
+      return result;
+    }
+
+  result = new TColStd_HSequenceOfHAsciiString;
+
+  WOKernel_DataMapIteratorOfDataMapOfFileType anit(mytypes);
+
+  while(anit.More())
+    {
+      thetype = anit.Value();
+
+      if(((hasentity && thetype->IsEntityDependent()) || !hasentity) &&
+        ((thetype->IsFileDependent() && thetype->IsFile()) || thetype->IsDirectory()))
+       {
+         if(thetype->IsStationDependent() && thetype->IsDBMSDependent())
+           {
+             bothdep.Append(thetype);
+           }
+         else if(thetype->IsStationDependent())
+           {
+             stationdep.Append(thetype);
+           }
+         else if(thetype->IsDBMSDependent())
+           {
+             dbmsdep.Append(thetype);
+           }
+         else
+           {
+             nothingdep.Append(thetype);
+           }
+       }
+
+      anit.Next();
+    }
+
+  SetNeededArguments(Theentity, dbmss->Value(1), stations->Value(1));
+
+  for(i=1; i<=nothingdep.Length(); i++)
+    {
+      apath = nothingdep.Value(i)->GetDirectory(Theentity->Params());
+
+      if(!apath.IsNull())
+       {
+         if(!amap.Contains(apath))
+           {
+             amap.Add(apath);
+             result->Append(apath);
+           }
+       }
+    }
+
+  for(i=1; i<=dbmsdep.Length(); i++)
+    {
+      for(j=1; j<=dbmss->Length(); j++)
+       {
+         SetNeededArguments(Theentity, dbmss->Value(j), stations->Value(1));
+         
+         apath = dbmsdep.Value(i)->GetDirectory(Theentity->Params());
+         
+         if(!apath.IsNull())
+           {
+             if(!amap.Contains(apath))
+               {
+                 amap.Add(apath);
+                 result->Append(apath);
+               }
+           }
+       }
+    }
+
+  for(i=1; i<=stationdep.Length(); i++)
+    {
+      for(j=1; j<=stations->Length(); j++)
+       {
+         SetNeededArguments(Theentity, dbmss->Value(1), stations->Value(j));
+         
+         apath = stationdep.Value(i)->GetDirectory(Theentity->Params());
+         
+         if(!apath.IsNull())
+           {
+             if(!amap.Contains(apath))
+               {
+                 amap.Add(apath);
+                 result->Append(apath);
+               }
+           }
+       }
+    }
+
+  for(i=1; i<=bothdep.Length(); i++)
+    {
+      for(j=1; j<=dbmss->Length(); j++)
+       { 
+         for(k=1; k<=stations->Length(); k++)
+           {
+             SetNeededArguments(Theentity, dbmss->Value(j), stations->Value(k));
+         
+             apath = bothdep.Value(i)->GetDirectory(Theentity->Params());
+             
+             if(!apath.IsNull())
+               {
+                 if(!amap.Contains(apath))
+                   {
+                     amap.Add(apath);
+                     result->Append(apath);
+                   }
+               }
+           }
+       }
+    }
+
+  Standard_Integer MaxLen = 0 ;
+
+  for(i=1; i<=result->Length(); i++)
+    {
+      if(result->Value(i)->Length() > MaxLen) MaxLen = result->Value(i)->Length();
+    }
+
+  WOKernel_Array1OfHSequenceOfHAsciiString pathtab(1, MaxLen);
+  Standard_Integer len;
+
+  for(i=1; i<=result->Length(); i++)
+    {
+      len = result->Value(i)->Length();
+
+      if(pathtab(len).IsNull()) pathtab(len) = new TColStd_HSequenceOfHAsciiString;
+
+      pathtab(len)->Append(result->Value(i));
+    }
+
+  Handle(TColStd_HSequenceOfHAsciiString) TheResult = new TColStd_HSequenceOfHAsciiString;
+
+  for(len=1; len<=MaxLen; len++)
+    {
+      if(!pathtab(len).IsNull())
+       {
+         Handle(TColStd_HSequenceOfHAsciiString) lenseq = pathtab(len);
+         for(i=1; i<=lenseq->Length(); i++)
+           {
+             TheResult->Append(lenseq->Value(i));
+           }
+       }
+    }
+
+  
+  // On ferme/reouvre afin de retrouver notre bonne station
+  //Theentity->Close();
+  //Theentity->Open();
+
+  return TheResult;
+}
+
+//=======================================================================
+//function : GetDirectories
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_FileTypeBase::GetDirectories(const Handle(WOKernel_Entity)& Theentity,
+                                                                             const Handle(WOKernel_HSequenceOfDBMSID)& dbmss,
+                                                                             const Handle(WOKernel_HSequenceOfStationID)& stations,
+                                                                             const Standard_Boolean getNestingdir,
+                                                                             const Standard_Boolean getEntitydir,
+                                                                             const Standard_Boolean getNestingAndEntitydir,
+                                                                             const Standard_Boolean getDbmsdir,
+                                                                             const Standard_Boolean getStationsdir,
+                                                                             const Standard_Boolean getStationsAndDbmsdir,
+                                                                             const Standard_Boolean getIndependentdir) const
+{
+  WOKTools_MapOfHAsciiString amap;
+  Standard_Integer i,j, k;
+  Handle(TCollection_HAsciiString) dollars = new TCollection_HAsciiString("$$$$$$$$$$$$$$$$$");
+  Handle(TCollection_HAsciiString) theunit, thenesting, apath;
+  Handle(TColStd_HSequenceOfHAsciiString) result;
+  Handle(WOKernel_FileType) thetype;
+
+  if(Theentity.IsNull()) return result;
+
+  WOKernel_SequenceOfFileType stationdep, dbmsdep, stationAnddbmsdep, independent;
+
+  Handle(TCollection_HAsciiString) anesting, aunit = Theentity->Name();
+  Handle(WOKernel_Entity)          Thenesting;
+
+  if(!Theentity->Nesting().IsNull())
+    {
+      Thenesting = Theentity->Session()->GetEntity(Theentity->Nesting());
+      
+      if(!Thenesting.IsNull())
+       {
+         anesting = Thenesting->Name();
+       }
+    }
+
+  
+  if(anesting.IsNull()) thenesting = dollars;
+  else                  thenesting = anesting;
+
+  if(aunit.IsNull()) theunit = dollars;
+  else               theunit = aunit;
+  
+
+  if(!dbmss->Length())
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::GetDirectories" 
+              << "Valid DBMS systems can't be empty." << endm;
+      return result;
+    }
+  
+  if(!stations->Length())
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::GetDirectories" 
+              << "Valid Stations can't be empty." << endm;
+      return result;
+    }
+
+  result = new TColStd_HSequenceOfHAsciiString;
+
+  WOKernel_DataMapIteratorOfDataMapOfFileType anit(mytypes);
+
+  Standard_Boolean add;
+
+  while(anit.More())
+    {
+      thetype = anit.Value();
+
+      add = Standard_False;
+
+      if (thetype->IsEntityDependent() && thetype->IsNestingDependent() && getNestingAndEntitydir) 
+       add = Standard_True;
+      
+      else if (thetype->IsNestingDependent() && getNestingdir) 
+       add = Standard_True;
+      
+      else if (thetype->IsEntityDependent() && getEntitydir) 
+       add = Standard_True;
+      
+      else if (!thetype->IsEntityDependent() && !thetype->IsNestingDependent() && getIndependentdir)
+       add = Standard_True;
+      
+      if (add)
+       {
+         if(thetype->IsStationDependent() && thetype->IsDBMSDependent())
+           stationAnddbmsdep.Append(thetype);
+         
+         else if(thetype->IsStationDependent())
+           stationdep.Append(thetype);
+         
+         else if(thetype->IsDBMSDependent())
+           dbmsdep.Append(thetype);
+         
+         else
+           independent.Append(thetype);
+       }
+
+      anit.Next();
+    }
+
+  SetNeededArguments(Theentity, dbmss->Value(1), stations->Value(1));
+
+  if (getDbmsdir)
+    {
+      for(i=1; i<=dbmsdep.Length(); i++)
+       {
+         for(j=1; j<=dbmss->Length(); j++)
+           {
+             SetNeededArguments(Theentity, dbmss->Value(j), stations->Value(1));
+             
+             apath = dbmsdep.Value(i)->GetDirectory(Theentity->Params());
+             
+             if(!apath.IsNull())
+               {
+                 if(!amap.Contains(apath))
+                   {
+                     amap.Add(apath);
+                     result->Append(apath);
+                   }
+               }
+           }
+       }
+    }
+
+  if(getStationsdir)
+    {
+      for(i=1; i<=stationdep.Length(); i++)
+       {
+         for(j=1; j<=stations->Length(); j++)
+           {
+             SetNeededArguments(Theentity, dbmss->Value(1), stations->Value(j));
+             
+             apath = stationdep.Value(i)->GetDirectory(Theentity->Params());
+             
+             if(!apath.IsNull())
+               {
+                 if(!amap.Contains(apath))
+                   {
+                     amap.Add(apath);
+                     result->Append(apath);
+                   }
+               }
+           }
+       }
+    }
+  
+  if(getStationsAndDbmsdir)
+    {
+      for(i=1; i<=stationAnddbmsdep.Length(); i++)
+       {
+         for(j=1; j<=dbmss->Length(); j++)
+           { 
+             for(k=1; k<=stations->Length(); k++)
+               {
+                 SetNeededArguments(Theentity, dbmss->Value(j), stations->Value(k));
+                 
+                 apath = stationAnddbmsdep.Value(i)->GetDirectory(Theentity->Params());
+                 
+                 if(!apath.IsNull())
+                   {
+                     if(!amap.Contains(apath))
+                       {
+                         amap.Add(apath);
+                         result->Append(apath);
+                       }
+                   }
+               }
+           }
+       }
+    }
+  
+  if(getIndependentdir)
+    {
+      for(i=1; i<=independent.Length(); i++)
+       {
+         apath = independent.Value(i)->GetDirectory(Theentity->Params());
+         
+         if(!apath.IsNull())
+           {
+             if(!amap.Contains(apath))
+               {
+                 amap.Add(apath);
+                 result->Append(apath);
+               }
+           }
+       }
+    }
+
+  Standard_Integer MaxLen = 0 ;
+
+  for(i=1; i<=result->Length(); i++)
+    {
+      if(result->Value(i)->Length() > MaxLen) MaxLen = result->Value(i)->Length();
+    }
+
+  WOKernel_Array1OfHSequenceOfHAsciiString pathtab(1, MaxLen);
+  Standard_Integer len;
+
+  for(i=1; i<=result->Length(); i++)
+    {
+      len = result->Value(i)->Length();
+
+      if(pathtab(len).IsNull()) pathtab(len) = new TColStd_HSequenceOfHAsciiString;
+
+      pathtab(len)->Append(result->Value(i));
+    }
+
+  Handle(TColStd_HSequenceOfHAsciiString) TheResult = new TColStd_HSequenceOfHAsciiString;
+
+  for(len=1; len<=MaxLen; len++)
+    {
+      if(!pathtab(len).IsNull())
+       {
+         Handle(TColStd_HSequenceOfHAsciiString) lenseq = pathtab(len);
+         for(i=1; i<=lenseq->Length(); i++)
+           {
+             TheResult->Append(lenseq->Value(i));
+           }
+       }
+    }
+
+  // On ferme/reouvre afin de retrouver notre bonne station
+  //Theentity->Close();
+  //Theentity->Open();
+
+  return TheResult;
+}
+
+
+//=======================================================================
+//function : GetFiles
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_FileTypeBase::GetFiles(const Handle(WOKernel_Entity)& Theentity,
+                                                                       const Handle(WOKernel_HSequenceOfDBMSID)& dbmss,
+                                                                       const Handle(WOKernel_HSequenceOfStationID)& stations,
+                                                                       const Standard_Boolean hasentity)
+     const
+{
+  WOKTools_MapOfHAsciiString amap;
+  Standard_Integer i,j, k;
+  Handle(TCollection_HAsciiString) dollars = new TCollection_HAsciiString("$$$$$$$$$$$$$$$$$");
+  Handle(TCollection_HAsciiString) theunit, thenesting, apath;
+  Handle(TColStd_HSequenceOfHAsciiString) result;
+  Handle(WOKernel_FileType) thetype;
+
+  if(Theentity.IsNull()) return result;
+
+  WOKernel_SequenceOfFileType  nothingdep, stationdep, dbmsdep, bothdep;
+
+  Handle(TCollection_HAsciiString) anesting, aunit = Theentity->Name();
+  Handle(WOKernel_Entity) Thenesting;
+
+  if(!Theentity->Nesting().IsNull())
+    {
+      Thenesting = Theentity->Session()->GetEntity(Theentity->Nesting());
+      
+      if(!Thenesting.IsNull())
+       {
+         anesting = Thenesting->Name();
+       }
+    }
+  
+  if(anesting.IsNull()) thenesting = dollars;
+  else                  thenesting = anesting;
+
+  if(aunit.IsNull()) theunit = dollars;
+  else               theunit = aunit;
+  
+
+  if(!dbmss->Length())
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::GetDirectories" 
+              << "Valid DBMS systems can't be empty." << endm;
+      return result;
+    }
+  
+  if(!stations->Length())
+    {
+      ErrorMsg << "WOKernel_FileTypeBase::GetDirectories" 
+              << "Valid Stations can't be empty." << endm;
+      return result;
+    }
+
+  result = new TColStd_HSequenceOfHAsciiString;
+
+  WOKernel_DataMapIteratorOfDataMapOfFileType anit(mytypes);
+
+  while(anit.More())
+    {
+      thetype = anit.Value();
+      if(thetype->IsStationDependent() && thetype->IsDBMSDependent())
+       {
+         bothdep.Append(thetype);
+       }
+      else if(thetype->IsStationDependent())
+       {
+         stationdep.Append(thetype);
+       }
+      else if(thetype->IsDBMSDependent())
+       {
+         dbmsdep.Append(thetype);
+       }
+      else
+       {
+         nothingdep.Append(thetype);
+       }
+
+      anit.Next();
+    }
+
+  SetNeededArguments(Theentity, dbmss->Value(1), stations->Value(1));
+
+  for(i=1; i<=nothingdep.Length(); i++)
+    {
+      apath = nothingdep.Value(i)->GetFile(Theentity->Params());
+
+      if(!apath.IsNull())
+       {
+         if(!amap.Contains(apath))
+           {
+             amap.Add(apath);
+             result->Append(apath);
+           }
+       }
+    }
+
+  for(i=1; i<=dbmsdep.Length(); i++)
+    {
+      for(j=1; j<=dbmss->Length(); j++)
+       {
+         SetNeededArguments(Theentity, dbmss->Value(j), stations->Value(1));
+         
+         apath = dbmsdep.Value(i)->GetFile(Theentity->Params());
+         
+         if(!apath.IsNull())
+           {
+             if(!amap.Contains(apath))
+               {
+                 amap.Add(apath);
+                 result->Append(apath);
+               }
+           }
+       }
+    }
+
+  for(i=1; i<=stationdep.Length(); i++)
+    {
+      for(j=1; j<=stations->Length(); j++)
+       {
+         SetNeededArguments(Theentity, dbmss->Value(1), stations->Value(j));
+         
+         apath = stationdep.Value(i)->GetFile(Theentity->Params());
+         
+         if(!apath.IsNull())
+           {
+             if(!amap.Contains(apath))
+               {
+                 amap.Add(apath);
+                 result->Append(apath);
+               }
+           }
+       }
+    }
+
+  for(i=1; i<=bothdep.Length(); i++)
+    {
+      for(j=1; j<=dbmss->Length(); j++)
+       { 
+         for(k=1; k<=stations->Length(); k++)
+           {
+             SetNeededArguments(Theentity, dbmss->Value(j), stations->Value(k));
+         
+             apath = bothdep.Value(i)->GetFile(Theentity->Params());
+             
+             if(!apath.IsNull())
+               {
+                 if(!amap.Contains(apath))
+                   {
+                     amap.Add(apath);
+                     result->Append(apath);
+                   }
+               }
+           }
+       }
+    }
+  // On ferme/reouvre afin de retrouver notre bonne station
+  //Theentity->Close();
+  //Theentity->Open();
+
+  return result;
+}
+
+//=======================================================================
+//function : TypeIterator
+//purpose  : 
+//=======================================================================
+WOKernel_FileTypeIterator WOKernel_FileTypeBase::TypeIterator() const
+{
+  WOKernel_FileTypeIterator theit(mytypes);
+
+  return theit;
+}
diff --git a/src/WOKernel/WOKernel_FileTypeHasher.cdl b/src/WOKernel/WOKernel_FileTypeHasher.cdl
new file mode 100755 (executable)
index 0000000..6e7b2d9
--- /dev/null
@@ -0,0 +1,24 @@
+-- File:       WOKernel_FileTypeHasher.cdl
+-- Created:    Tue Oct 10 20:10:18 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class FileTypeHasher from WOKernel 
+
+       ---Purpose: 
+
+uses
+    FileType from WOKernel
+
+is
+
+    HashCode(myclass; akey : FileType from WOKernel)
+       returns Integer from Standard;
+       
+    IsEqual(myclass; akey1, akey2: FileType from WOKernel)
+       returns Boolean from Standard;
+
+
+end FileTypeHasher;
diff --git a/src/WOKernel/WOKernel_FileTypeHasher.cxx b/src/WOKernel/WOKernel_FileTypeHasher.cxx
new file mode 100755 (executable)
index 0000000..653a088
--- /dev/null
@@ -0,0 +1,25 @@
+// File:       WOKernel_FileTypeHasher.cxx
+// Created:    Tue Oct 10 20:11:36 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKernel_FileTypeHasher.ixx>
+
+
+//=======================================================================
+//function : HashCode
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKernel_FileTypeHasher::HashCode(const Handle(WOKernel_FileType)& atype)
+{
+  Standard_Integer aHashCode =  (Standard_Integer ) (long) atype.operator->();
+  return aHashCode;
+}
+
+Standard_Boolean WOKernel_FileTypeHasher::IsEqual(const Handle(WOKernel_FileType)& K1,
+                                                 const Handle(WOKernel_FileType)& K2)
+{
+  if(K1.operator->() == K2.operator->()) return Standard_True;
+  return Standard_False;
+}
diff --git a/src/WOKernel/WOKernel_FileTypeKeyWords.cxx b/src/WOKernel/WOKernel_FileTypeKeyWords.cxx
new file mode 100755 (executable)
index 0000000..5744ded
--- /dev/null
@@ -0,0 +1,99 @@
+
+
+#include <WOKernel_FileTypeKeyWords.hxx>
+
+#define IMPLEMENT_WOK_STATIC(Name,Value) extern Standard_EXPORT const char Name [] = Value;
+
+IMPLEMENT_WOK_STATIC(WOKENTITY,"WOKEntity")
+IMPLEMENT_WOK_STATIC(WOKENTITYFILELIST,"%WOKEntity_FileList")
+IMPLEMENT_WOK_STATIC(WOKENTITYDIRLIST,"%WOKEntity_DirList")
+IMPLEMENT_WOK_STATIC(WOKENTITYPARAMLIST,"%WOKEntity_ParamList")
+
+
+//BuildCustomistation
+IMPLEMENT_WOK_STATIC(WOKENTITYBEFOREBUID,"WOKEntity_BeforeBuild")
+IMPLEMENT_WOK_STATIC(WOKENTITYAFTERBUILD,"WOKEntity_AfterBuild")
+IMPLEMENT_WOK_STATIC(WOKENTITYBEFOREDESTROY,"WOKEntity_BeforeDestroy")
+IMPLEMENT_WOK_STATIC(WOKENTITYAFTERDESTROY,"WOKEntity_AfterDestroy")
+
+IMPLEMENT_WOK_STATIC(TYPEPREFIX,"WOKEntity_")
+
+
+
+IMPLEMENT_WOK_STATIC(NESTINGVAR,"%Nesting")
+IMPLEMENT_WOK_STATIC(NESTINGTYPEVAR,"%NestingType")
+IMPLEMENT_WOK_STATIC(NESTINGPATHVAR,"%NestingPath")
+IMPLEMENT_WOK_STATIC(NESTING_PREFIX,"%Nesting_")
+IMPLEMENT_WOK_STATIC(NESTING_STATION,"%Nesting_Station")
+IMPLEMENT_WOK_STATIC(NESTING_DBMS,"%Nesting_DBMS")
+IMPLEMENT_WOK_STATIC(NESTING_DBMS_STATION,"%Nesting_DBMS_Station")
+
+IMPLEMENT_WOK_STATIC(ENTITYVAR,"%Entity")
+IMPLEMENT_WOK_STATIC(ENTITYTYPEVAR,"%EntityType")
+IMPLEMENT_WOK_STATIC(ENTITYPATHVAR,"%EntityPath")
+IMPLEMENT_WOK_STATIC(ENTITY_PREFIX,"%Entity_")
+IMPLEMENT_WOK_STATIC(ENTITY_STATION,"%Entity_Station")
+IMPLEMENT_WOK_STATIC(ENTITY_DBMS,"%Entity_DBMS")
+IMPLEMENT_WOK_STATIC(ENTITY_DBMS_STATION,"%Entity_DBMS_Station")
+
+IMPLEMENT_WOK_STATIC(STATION_SUFFIX,"Station")
+IMPLEMENT_WOK_STATIC(DBMS_SUFFIX,"DBMS")
+IMPLEMENT_WOK_STATIC(STATIONS_SUFFIX,"Stations")
+IMPLEMENT_WOK_STATIC(DBMSYSTEMS_SUFFIX,"DBMSystems")
+
+IMPLEMENT_WOK_STATIC(LOCALARCHVAR,"%LocalArch")
+IMPLEMENT_WOK_STATIC(STATIONVAR,"%Station")
+IMPLEMENT_WOK_STATIC(DBMSVAR,"%DBMS")
+IMPLEMENT_WOK_STATIC(FILEVAR,"%File")
+
+
+
+
+
+
+#define IMPLEMENT_WOK_STATIC_STRING(aStr) \
+Standard_EXPORT const Handle(TCollection_HAsciiString)& WOK_STATIC_##aStr() {\
+  static Handle(TCollection_HAsciiString) TheStaticString = new TCollection_HAsciiString((Standard_CString) aStr); \
+  return TheStaticString; \
+}
+
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITY)
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITYFILELIST)
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITYDIRLIST)
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITYPARAMLIST)
+
+
+
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITYBEFOREBUID)
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITYAFTERBUILD)
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITYBEFOREDESTROY)
+IMPLEMENT_WOK_STATIC_STRING(WOKENTITYAFTERDESTROY)
+
+IMPLEMENT_WOK_STATIC_STRING(TYPEPREFIX)
+
+
+
+IMPLEMENT_WOK_STATIC_STRING(NESTINGVAR)
+IMPLEMENT_WOK_STATIC_STRING(NESTINGTYPEVAR)
+IMPLEMENT_WOK_STATIC_STRING(NESTINGPATHVAR)
+IMPLEMENT_WOK_STATIC_STRING(NESTING_PREFIX)
+IMPLEMENT_WOK_STATIC_STRING(NESTING_STATION)
+IMPLEMENT_WOK_STATIC_STRING(NESTING_DBMS)
+IMPLEMENT_WOK_STATIC_STRING(NESTING_DBMS_STATION)
+
+IMPLEMENT_WOK_STATIC_STRING(ENTITYVAR)
+IMPLEMENT_WOK_STATIC_STRING(ENTITYTYPEVAR)
+IMPLEMENT_WOK_STATIC_STRING(ENTITYPATHVAR)
+IMPLEMENT_WOK_STATIC_STRING(ENTITY_PREFIX)
+IMPLEMENT_WOK_STATIC_STRING(ENTITY_STATION)
+IMPLEMENT_WOK_STATIC_STRING(ENTITY_DBMS)
+IMPLEMENT_WOK_STATIC_STRING(ENTITY_DBMS_STATION)
+
+IMPLEMENT_WOK_STATIC_STRING(STATION_SUFFIX)
+IMPLEMENT_WOK_STATIC_STRING(DBMS_SUFFIX)
+
+IMPLEMENT_WOK_STATIC_STRING(LOCALARCHVAR)
+IMPLEMENT_WOK_STATIC_STRING(STATIONVAR)
+IMPLEMENT_WOK_STATIC_STRING(DBMSVAR)
+IMPLEMENT_WOK_STATIC_STRING(FILEVAR)
+
diff --git a/src/WOKernel/WOKernel_FileTypeKeyWords.hxx b/src/WOKernel/WOKernel_FileTypeKeyWords.hxx
new file mode 100755 (executable)
index 0000000..a3767f1
--- /dev/null
@@ -0,0 +1,108 @@
+// File:       WOKernel_FileTypeKeyWords.hxx
+// Created:    Wed Feb 28 16:57:08 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#ifndef WOKernel_FileTypeKeyWords_HeaderFile
+#define WOKernel_FileTypeKeyWords_HeaderFile
+
+#include <Standard_Macro.hxx>
+#include <TCollection_HAsciiString.hxx>
+
+#define DECLARE_WOK_STATIC(aStr) Standard_IMPORT extern const char aStr [];
+
+DECLARE_WOK_STATIC(WOKENTITY)
+DECLARE_WOK_STATIC(WOKENTITYFILELIST)
+DECLARE_WOK_STATIC(WOKENTITYDIRLIST)
+DECLARE_WOK_STATIC(WOKENTITYPARAMLIST)
+
+
+// Build Customistation
+DECLARE_WOK_STATIC(WOKENTITYBEFOREBUID)
+DECLARE_WOK_STATIC(WOKENTITYAFTERBUILD)
+DECLARE_WOK_STATIC(WOKENTITYBEFOREDESTROY)
+DECLARE_WOK_STATIC(WOKENTITYAFTERDESTROY)
+
+DECLARE_WOK_STATIC(TYPEPREFIX)
+
+
+
+DECLARE_WOK_STATIC(NESTINGVAR)
+DECLARE_WOK_STATIC(NESTINGTYPEVAR)
+DECLARE_WOK_STATIC(NESTINGPATHVAR)
+DECLARE_WOK_STATIC(NESTING_PREFIX)
+DECLARE_WOK_STATIC(NESTING_STATION)
+DECLARE_WOK_STATIC(NESTING_DBMS)
+DECLARE_WOK_STATIC(NESTING_DBMS_STATION)
+
+DECLARE_WOK_STATIC(ENTITYVAR)
+DECLARE_WOK_STATIC(ENTITYTYPEVAR)
+DECLARE_WOK_STATIC(ENTITYPATHVAR)
+DECLARE_WOK_STATIC(ENTITY_PREFIX)
+DECLARE_WOK_STATIC(ENTITY_STATION)
+DECLARE_WOK_STATIC(ENTITY_DBMS)
+DECLARE_WOK_STATIC(ENTITY_DBMS_STATION)
+
+DECLARE_WOK_STATIC(STATION_SUFFIX)
+DECLARE_WOK_STATIC(DBMS_SUFFIX)
+DECLARE_WOK_STATIC(STATIONS_SUFFIX)
+DECLARE_WOK_STATIC(DBMSYSTEMS_SUFFIX)
+
+DECLARE_WOK_STATIC(LOCALARCHVAR)
+DECLARE_WOK_STATIC(STATIONVAR)
+DECLARE_WOK_STATIC(DBMSVAR)
+DECLARE_WOK_STATIC(FILEVAR)
+
+
+
+
+
+
+#define DECLARE_WOK_STATIC_STRING(aStr) extern Standard_EXPORT  const Handle(TCollection_HAsciiString)& WOK_STATIC_##aStr();
+
+
+
+DECLARE_WOK_STATIC_STRING(WOKENTITY)
+DECLARE_WOK_STATIC_STRING(WOKENTITYFILELIST)
+DECLARE_WOK_STATIC_STRING(WOKENTITYDIRLIST)
+DECLARE_WOK_STATIC_STRING(WOKENTITYPARAMLIST)
+
+
+
+DECLARE_WOK_STATIC_STRING(WOKENTITYBEFOREBUID)
+DECLARE_WOK_STATIC_STRING(WOKENTITYAFTERBUILD)
+DECLARE_WOK_STATIC_STRING(WOKENTITYBEFOREDESTROY)
+DECLARE_WOK_STATIC_STRING(WOKENTITYAFTERDESTROY)
+
+DECLARE_WOK_STATIC_STRING(TYPEPREFIX)
+
+
+
+DECLARE_WOK_STATIC_STRING(NESTINGVAR)
+DECLARE_WOK_STATIC_STRING(NESTINGTYPEVAR)
+DECLARE_WOK_STATIC_STRING(NESTINGPATHVAR)
+DECLARE_WOK_STATIC_STRING(NESTING_PREFIX)
+DECLARE_WOK_STATIC_STRING(NESTING_STATION)
+DECLARE_WOK_STATIC_STRING(NESTING_DBMS)
+DECLARE_WOK_STATIC_STRING(NESTING_DBMS_STATION)
+
+DECLARE_WOK_STATIC_STRING(ENTITYVAR)
+DECLARE_WOK_STATIC_STRING(ENTITYTYPEVAR)
+DECLARE_WOK_STATIC_STRING(ENTITYPATHVAR)
+DECLARE_WOK_STATIC_STRING(ENTITY_PREFIX)
+DECLARE_WOK_STATIC_STRING(ENTITY_STATION)
+DECLARE_WOK_STATIC_STRING(ENTITY_DBMS)
+DECLARE_WOK_STATIC_STRING(ENTITY_DBMS_STATION)
+
+DECLARE_WOK_STATIC_STRING(STATION_SUFFIX)
+DECLARE_WOK_STATIC_STRING(DBMS_SUFFIX)
+DECLARE_WOK_STATIC_STRING(STATIONS_SUFFIX)
+DECLARE_WOK_STATIC_STRING(DBMSYSTEMS_SUFFIX)
+
+DECLARE_WOK_STATIC_STRING(LOCALARCHVAR)
+DECLARE_WOK_STATIC_STRING(STATIONVAR)
+DECLARE_WOK_STATIC_STRING(DBMSVAR)
+DECLARE_WOK_STATIC_STRING(FILEVAR)
+
+#endif
diff --git a/src/WOKernel/WOKernel_GlobalFileTypeBase.cdl b/src/WOKernel/WOKernel_GlobalFileTypeBase.cdl
new file mode 100755 (executable)
index 0000000..c9e53ef
--- /dev/null
@@ -0,0 +1,29 @@
+-- File:       WOKernel_GlobalFileTypeBase.cdl
+-- Created:    Sat Oct 25 00:08:55 1997
+-- Author:     
+--             <jga@GROMINEX>
+---Copyright:   Matra Datavision 1997
+
+
+class GlobalFileTypeBase from WOKernel 
+inherits TShared from MMgt
+
+       ---Purpose: diminuer les chargement de FileTypeBase
+
+uses
+    FileTypeBase          from WOKernel,
+    DataMapOfFileTypeBase from WOKernel,
+    Entity from WOKernel
+is
+
+    Create
+       returns mutable GlobalFileTypeBase from WOKernel;
+       
+    GetFileTypeBase(me:mutable; anentity : Entity from WOKernel)
+       returns FileTypeBase from WOKernel;
+
+fields
+    
+    mybases : DataMapOfFileTypeBase from WOKernel;
+
+end GlobalFileTypeBase;
diff --git a/src/WOKernel/WOKernel_GlobalFileTypeBase.cxx b/src/WOKernel/WOKernel_GlobalFileTypeBase.cxx
new file mode 100755 (executable)
index 0000000..865b9ca
--- /dev/null
@@ -0,0 +1,60 @@
+
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <WOKernel_Entity.hxx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_Session.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+
+#include <WOKernel_GlobalFileTypeBase.ixx>
+
+
+
+WOKernel_GlobalFileTypeBase::WOKernel_GlobalFileTypeBase()
+{
+}
+
+
+Handle(WOKernel_FileTypeBase) WOKernel_GlobalFileTypeBase::GetFileTypeBase(const Handle(WOKernel_Entity)& anent)
+{
+  Handle(WOKernel_FileTypeBase) nullresult;
+  Handle(WOKernel_Session)      asession = anent->Session();
+
+  if(anent.IsNull()) return nullresult;
+  
+  Handle(TCollection_HAsciiString) baseid = new TCollection_HAsciiString;
+
+  Handle(WOKernel_Entity) theent = anent;
+
+  while(!theent.IsNull())
+    {
+      if(!asession->IsDevUnit(theent->FullName()))
+       baseid->Prepend(theent->EntityCode());
+      else
+       {
+         const Handle(WOKernel_DevUnit)& unit = asession->GetDevUnit(theent->FullName());
+         baseid->Prepend(unit->Type());
+       }
+      if(theent->Nesting().IsNull())
+         theent.Nullify();
+      else
+       {
+         static Handle(TCollection_HAsciiString) PP = new TCollection_HAsciiString(":");
+         baseid->Prepend(PP);
+         theent = asession->GetEntity(theent->Nesting());
+       }
+    }
+
+  if(mybases.IsBound(baseid)) return mybases.Find(baseid);
+  else
+    {
+      Handle(WOKernel_FileTypeBase) abase = new WOKernel_FileTypeBase;
+
+      abase->Load(anent->Params());
+
+      mybases.Bind(baseid, abase);
+
+      return abase;
+    }
+}
diff --git a/src/WOKernel/WOKernel_HAsciiStringHasher.cdl b/src/WOKernel/WOKernel_HAsciiStringHasher.cdl
new file mode 100755 (executable)
index 0000000..3ce119e
--- /dev/null
@@ -0,0 +1,24 @@
+-- File:       WOKernel_HAsciiStringHasher.cdl
+-- Created:    Thu Feb  6 16:48:56 1997
+-- Author:     Prestataire Pascal BABIN
+--             <pba@voilax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1997
+
+private class HAsciiStringHasher from WOKernel
+uses
+    HAsciiString from TCollection
+is
+
+   HashCode(myclass; Key : HAsciiString from TCollection; Upper : Integer from Standard) returns Integer;
+           ---Level: Public
+       ---Purpose: Returns a HasCode value  for  the  Key <K>  in the
+       -- range 0..Upper.
+       -- Default ::HashCode(K,Upper)
+           
+   IsEqual(myclass; K1, K2 : HAsciiString from TCollection) returns Boolean;
+       ---Level: Public
+       ---Purpose: Returns True  when the two  keys are the same. Two
+       -- same  keys  must   have  the  same  hashcode,  the
+       -- contrary is not necessary.
+       -- Default K1 == K2
+end;
diff --git a/src/WOKernel/WOKernel_HAsciiStringHasher.cxx b/src/WOKernel/WOKernel_HAsciiStringHasher.cxx
new file mode 100755 (executable)
index 0000000..2bb2257
--- /dev/null
@@ -0,0 +1,46 @@
+// File:       WOKernel_HAsciiStringHasher.cxx
+// Created:    Thu Feb  6 16:52:00 1997
+// Author:     Prestataire Pascal BABIN
+//             <pba@voilax.paris1.matra-dtv.fr>
+
+#include <WOKernel_HAsciiStringHasher.ixx>
+
+//=======================================================================
+//function : HashCode
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKernel_HAsciiStringHasher::HashCode (const Handle(TCollection_HAsciiString) &Value,
+                                                       const Standard_Integer Upper)
+
+{
+  
+  if(Value.IsNull() == Standard_True) return 0;
+  
+  Standard_CString charPtr   = (Standard_CString)Value->ToCString();
+  Standard_Integer aHashCode = 0,  alen,  i  = 0,  pos = 0,  count,  *tmphash;
+  Standard_Character tabchar[20];
+  
+  alen = Value->Length();
+  
+  while(i < alen) {
+    for (count = 0,pos = i;count < sizeof(int); count++) {
+      if (pos + count >= alen)  tabchar[count] = '\0';
+      else tabchar[count] = charPtr[pos + count];
+      i++;
+    }
+    tmphash = (int *)tabchar;   
+    aHashCode = aHashCode ^ *tmphash;
+  }
+  return aHashCode % Upper;
+}
+
+//=======================================================================
+//function : IsEqual
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_HAsciiStringHasher::IsEqual(const Handle(TCollection_HAsciiString) &K1, const Handle(TCollection_HAsciiString) &K2)
+{
+  if (strcmp(K1->ToCString(), K2->ToCString()) == 0) return(Standard_True);
+  else                                               return(Standard_False);
+}
+
diff --git a/src/WOKernel/WOKernel_ImplDepIterator.cdl b/src/WOKernel/WOKernel_ImplDepIterator.cdl
new file mode 100755 (executable)
index 0000000..934a742
--- /dev/null
@@ -0,0 +1,45 @@
+-- File:       WOKernel_ImplDepIterator.cdl
+-- Created:    Thu Feb  6 16:00:32 1997
+-- Author:     Prestataire Pascal BABIN
+--             <pba@voilax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1997
+
+private class ImplDepIterator from WOKernel
+
+uses
+
+    HSequenceOfHAsciiString from TColStd,
+    HAsciiString            from TCollection,
+    UnitGraph               from WOKernel
+    
+raises
+    NoMoreObject from Standard,
+    NoSuchObject from Standard
+is
+
+    Create (aDependencyGraph : UnitGraph from WOKernel; anUd : HAsciiString from TCollection) 
+       returns ImplDepIterator from WOKernel;
+
+    More (me) returns Boolean;
+       ---Purpose: Returns TRUE if there are other uds.
+
+    Next(me : in out)
+       --- Purpose : Set the iterator to the next ud.
+    raises NoMoreObject from Standard;
+
+    Value(me : out) returns HAsciiString from TCollection
+       --- Purpose: Returns the ud value for the current position
+       --           of the iterator.
+    raises NoSuchObject from Standard;
+
+    GetSuppliers(me : in out);
+    
+fields
+    
+    myDepGraph  : UnitGraph               from WOKernel;
+    myMore      : Boolean                 from Standard;
+    myCurrentUd : HAsciiString            from TCollection; 
+    mySuppliers : HSequenceOfHAsciiString from TColStd;
+    myIndex     : Integer                 from Standard;
+    
+end ImplDepIterator;
diff --git a/src/WOKernel/WOKernel_ImplDepIterator.cxx b/src/WOKernel/WOKernel_ImplDepIterator.cxx
new file mode 100755 (executable)
index 0000000..c23448f
--- /dev/null
@@ -0,0 +1,103 @@
+// File:       WOKernel_ImplDepIterator.cxx
+// Created:    Thu Feb  6 16:28:45 1997
+// Author:     Prestataire Pascal BABIN
+//             <pba@voilax.paris1.matra-dtv.fr>
+
+#include <Standard_NoMoreObject.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <Standard_ProgramError.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_MapOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <WOKernel_ImplDepIterator.ixx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_Locator.hxx>
+
+
+//=======================================================================
+//function : WOKernel_ImplDepIterator
+//purpose  : 
+//=======================================================================
+
+WOKernel_ImplDepIterator::WOKernel_ImplDepIterator (const Handle(WOKernel_UnitGraph) & aDependencyGraph,
+                                                   const Handle(TCollection_HAsciiString)& anUd)
+{
+  myDepGraph  = aDependencyGraph;
+  myCurrentUd = anUd;
+  myMore      = Standard_True;
+  myIndex     = 0;
+  GetSuppliers();
+}
+
+//=======================================================================
+//function : GetSuppliers
+//purpose  : 
+//=======================================================================
+void WOKernel_ImplDepIterator::GetSuppliers()
+{
+  if(!myDepGraph->Contains(myCurrentUd))
+    {
+      Handle(WOKernel_DevUnit) aunit = myDepGraph->Locator()->LocateDevUnit(myCurrentUd);
+      
+      if(!aunit.IsNull()) 
+       mySuppliers = aunit->ImplementationDepList(myDepGraph);
+    }
+  else
+    {
+      mySuppliers = myDepGraph->Suppliers(myCurrentUd);
+    } 
+
+  if (mySuppliers.IsNull()) {
+    ErrorMsg << "WOKernel_ImplDepIterator::GetSuppliers" << "Unable to get suppliers for unit " << myCurrentUd->ToCString() << endm;
+    myMore = Standard_False;
+  }
+  else if(!mySuppliers->Length()) {
+    myMore = Standard_False;
+  }
+  else {
+    myIndex = mySuppliers->Length();  
+  }
+}
+
+//=======================================================================
+//function : More
+//purpose  : 
+//=======================================================================
+
+Standard_Boolean WOKernel_ImplDepIterator::More () const 
+{
+  return myMore;
+}
+
+
+//=======================================================================
+//function : Next
+//purpose  : 
+//=======================================================================
+
+void WOKernel_ImplDepIterator::Next ()  
+{
+  Handle(TCollection_HAsciiString) aSupplier = mySuppliers->Value(myIndex);
+  myIndex--;
+
+  if (myIndex == 0) myMore = Standard_False;
+
+}
+
+
+//=======================================================================
+//function : Value
+//purpose  : 
+//=======================================================================
+
+Handle(TCollection_HAsciiString) WOKernel_ImplDepIterator::Value () 
+{  
+  return mySuppliers->Value(myIndex);
+}
+
+
+
diff --git a/src/WOKernel/WOKernel_Locator.cdl b/src/WOKernel/WOKernel_Locator.cdl
new file mode 100755 (executable)
index 0000000..268b081
--- /dev/null
@@ -0,0 +1,72 @@
+-- File:       WOKernel_Locator.cdl
+-- Created:    Fri Jan  5 16:36:45 1996
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1996
+
+
+class Locator from WOKernel 
+inherits TShared from MMgt
+
+       ---Purpose: 
+
+uses
+    Session                     from WOKernel,
+    File                        from WOKernel,
+    DevUnit                     from WOKernel,
+    UnitNesting                 from WOKernel,
+    Workbench                   from WOKernel,
+    Parcel                      from WOKernel,
+    DataMapOfHAsciiStringOfFile from WOKernel,
+    HSequenceOfHAsciiString     from TColStd,
+    HAsciiString                from TCollection
+    
+is
+
+    Create(awb : Workbench from WOKernel)
+       returns mutable Locator from WOKernel;
+
+    Create(asession : Session from WOKernel; avisibility : HSequenceOfHAsciiString from TColStd) 
+       returns mutable Locator from WOKernel;
+       
+    Session(me) returns Session from WOKernel;
+    Visibility(me) returns HSequenceOfHAsciiString from TColStd;
+
+    Reset(me:mutable);
+    Check(me:mutable);
+    
+    Locate(me:mutable; alocatorname : HAsciiString from TCollection;
+                      aunitname, atype, aname : HAsciiString from TCollection) 
+    ---C++: return const &
+       returns mutable File from WOKernel
+       is private;
+    
+    Locate(me:mutable; alocatorname : HAsciiString from TCollection) 
+    ---C++: return const &
+       returns mutable File from WOKernel;
+           
+    Locate(me:mutable; atype, aname : HAsciiString from TCollection) 
+    ---C++: return const &
+       returns mutable File from WOKernel;
+       
+    Locate(me:mutable; aunitname, atype, aname : HAsciiString from TCollection) 
+    ---C++: return const &
+       returns mutable File from WOKernel;
+
+    LocateDevUnit(me:mutable; adevunitname : HAsciiString from TCollection)
+       returns mutable DevUnit from WOKernel;
+       
+    ChangeAdd(me:mutable; afile : File from WOKernel)
+       returns Boolean from Standard;
+
+    ChangeRemove(me:mutable; afile : File from WOKernel)
+       returns Boolean from Standard;
+       
+
+fields
+
+    mysession    : Session                     from WOKernel;
+    mymap        : DataMapOfHAsciiStringOfFile from WOKernel;
+    myvisibility : HSequenceOfHAsciiString     from TColStd;
+    
+end Locator;
diff --git a/src/WOKernel/WOKernel_Locator.cxx b/src/WOKernel/WOKernel_Locator.cxx
new file mode 100755 (executable)
index 0000000..b5de4df
--- /dev/null
@@ -0,0 +1,333 @@
+// File:       WOKernel_Locator.cxx
+// Created:    Fri Jan  5 17:14:38 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <unistd.h>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+
+#include <WOKernel_Workshop.hxx>
+#include <WOKernel_Session.hxx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_FileType.hxx>
+#include <WOKernel_File.hxx>
+
+#include <WOKernel_Locator.ixx>
+
+#ifdef WNT
+#include <windows.h>
+#endif
+
+//=======================================================================
+//function : WOKernel_Locator
+//purpose  : 
+//=======================================================================
+ WOKernel_Locator::WOKernel_Locator(const Handle(WOKernel_Workbench)& awb)
+{
+  mysession = awb->Session();
+  //
+  // Recherche de la visibilite
+  //
+  Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+  Handle(WOKernel_Workbench) abench = awb;
+  
+  // l'heritage des workbenchs
+  while(abench.IsNull() == Standard_False)
+    {
+      aseq->Append(abench->FullName());
+      abench = mysession->GetWorkbench(abench->Father());
+    }
+
+  // les parcels
+  Handle(WOKernel_Workshop)               ashop     = mysession->GetWorkshop(awb->Nesting());
+  Handle(TColStd_HSequenceOfHAsciiString) parcelseq = ashop->ParcelsInUse();
+
+  for(Standard_Integer i=1; i<=parcelseq->Length(); i++)
+    {
+      aseq->Append(parcelseq->Value(i));
+    }
+  myvisibility = aseq;
+}
+
+//=======================================================================
+//function : WOKernel_Locator
+//purpose  : 
+//=======================================================================
+WOKernel_Locator::WOKernel_Locator(const Handle(WOKernel_Session)& asession, 
+                                  const Handle(TColStd_HSequenceOfHAsciiString)& avisibility)
+{
+  mysession = asession;
+  myvisibility= avisibility;
+}
+
+//=======================================================================
+//function : Session
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_Session) WOKernel_Locator::Session() const
+{
+  return mysession;
+}
+
+//=======================================================================
+//function : Visibility
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Locator::Visibility() const
+{
+  return myvisibility;
+}
+
+//=======================================================================
+//function : Reset
+//purpose  : 
+//=======================================================================
+void WOKernel_Locator::Reset()
+{
+  mymap.Clear();
+}
+
+//=======================================================================
+//function : Check
+//purpose  : 
+//=======================================================================
+void WOKernel_Locator::Check()
+{
+}
+
+//=======================================================================
+//function : Locate
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_File)& WOKernel_Locator::Locate(const Handle(TCollection_HAsciiString)& , 
+                                              const Handle(TCollection_HAsciiString)& )
+{
+  static Handle(WOKernel_File) nullresult;
+  return nullresult;
+}
+
+//=======================================================================
+//function : Locate
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_File)& WOKernel_Locator::Locate(const Handle(TCollection_HAsciiString)& alocatorname)
+{
+  static Handle(WOKernel_File) nullresult;
+  Handle(WOKernel_File) afile;
+
+  // le Fichier a t'il deja ete localise
+  if(mymap.IsBound(alocatorname)) 
+    {
+      WOK_TRACE {
+       VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate" 
+                                 << "Found in cache " << mymap.Find(alocatorname)->UserPathName() << endm;
+      }
+      return mymap.Find(alocatorname);
+    }
+  else
+    {
+      return Locate(alocatorname, alocatorname->Token(":", 1), alocatorname->Token(":", 2), alocatorname->Token(":", 3));
+    }
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Locate
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_File)& WOKernel_Locator::Locate(const Handle(TCollection_HAsciiString)& aunitname, 
+                                              const Handle(TCollection_HAsciiString)& atype, 
+                                              const Handle(TCollection_HAsciiString)& aname)
+{
+  Handle(TCollection_HAsciiString) locatorname = new TCollection_HAsciiString;
+  
+  locatorname->AssignCat(aunitname);
+  locatorname->AssignCat(":");
+  locatorname->AssignCat(atype);
+  locatorname->AssignCat(":");
+  locatorname->AssignCat(aname);
+
+  return Locate(locatorname, aunitname, atype, aname);
+}
+
+//=======================================================================
+//function : Locate
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_File)& WOKernel_Locator::Locate(const Handle(TCollection_HAsciiString)& locatorname,
+                                               const Handle(TCollection_HAsciiString)& aunitname, 
+                                               const Handle(TCollection_HAsciiString)& atype, 
+                                               const Handle(TCollection_HAsciiString)& aname)
+{
+  static Handle(WOKernel_File)    nullresult;
+  Handle(WOKernel_UnitNesting) anesting;
+  Handle(WOKernel_DevUnit) aunit;
+  Handle(WOKernel_File)    afile;
+  Handle(TCollection_HAsciiString) astr;
+  Standard_Integer i;
+
+  WOK_TRACE {
+    VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate" 
+                             << "Searching for " << locatorname << endm;
+  }
+  
+  // le Fichier a t'il deja ete localise
+  if(mymap.IsBound(locatorname)) 
+    {
+      WOK_TRACE {
+       VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate" 
+                                 << "Found in cache " << mymap.Find(locatorname)->UserPathName() << endm;
+      }
+      return mymap.Find(locatorname);
+    }
+
+  // Non : le faire
+
+  for(i=1; i<=myvisibility->Length(); i++)
+    {
+      
+      WOK_TRACE {
+       VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate" 
+                                 << "Looking in : " << myvisibility->Value(i) << endm;
+      }
+
+      anesting = mysession->GetUnitNesting(myvisibility->Value(i));
+
+      if(!anesting.IsNull())
+       {
+         if(!anesting->IsOpened()) anesting->Open();
+
+         aunit = mysession->GetDevUnit(anesting->NestedUniqueName(aunitname));
+         
+         if(aunit.IsNull() == Standard_False)
+           {
+             WOK_TRACE {
+               VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate" 
+                                         << aunitname << " is present" << endm;
+             }
+
+             if(!aunit->IsOpened()) aunit->Open();
+             
+             if(aunit->FileTypeBase()->IsType(atype))
+               {
+                 astr = aunit->GetFileType(atype)->ComputePath(aunit->Params(), aname);
+                 if (!astr.IsNull()) {
+#ifndef WNT
+                   if(!access(astr->ToCString(), F_OK))
+#else
+                     if ( GetFileAttributes(astr->ToCString()) != 0xFFFFFFFF )
+#endif
+                       {
+                         WOK_TRACE {
+                           VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate"
+                                                     << "Found " << locatorname << " at " << aunit->UserPathName() << endm;
+                         }
+                         afile = new WOKernel_File(aname, aunit, aunit->FileTypeBase()->Type(atype));
+                         afile->SetPath(new WOKUtils_Path(astr));
+                         mymap.Bind(locatorname, afile);
+                         return mymap.Find(locatorname);
+                       }
+                 }
+               }
+             else
+               {
+                 WarningMsg << "WOKernel_Locator::Locate" 
+                            << "Attempt to locate inexistent file type " << atype << " in " << aunit->UserPathName() << endm;
+               }
+           }
+       }
+      else
+       {
+         WOK_TRACE {
+           VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate"
+                                     << aunitname << " is NOT present" << endm;
+         }
+       }
+    }
+  return nullresult;
+}
+
+//=======================================================================
+//function : LocateUnit
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_DevUnit) WOKernel_Locator::LocateDevUnit(const Handle(TCollection_HAsciiString)& aunitname)
+{
+  Standard_Integer i;
+  Handle(WOKernel_UnitNesting) anesting;
+  Handle(WOKernel_DevUnit) adevunit;
+
+  for(i=1; i<=myvisibility->Length(); i++)
+    {
+      
+      WOK_TRACE {
+       VerboseMsg("WOK_LOCATOR") << "WOKernel_Locator::Locate" 
+                                 << "Looking in : " << myvisibility->Value(i) << endm;
+      }
+      
+      anesting = mysession->GetUnitNesting(myvisibility->Value(i));
+      
+      if(!anesting.IsNull())
+       {
+         if(!anesting->IsOpened()) anesting->Open();
+
+         adevunit = mysession->GetDevUnit(anesting->NestedUniqueName(aunitname));
+
+         if(adevunit.IsNull() == Standard_False)
+           {
+             if(!adevunit->IsOpened()) adevunit->Open();
+             return adevunit;
+           }
+       }
+    }
+
+  return adevunit;
+}
+
+//=======================================================================
+//function : ChangeAdd
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Locator::ChangeAdd(const Handle(WOKernel_File)& afile)
+{
+  Handle(TCollection_HAsciiString) astr;
+
+  afile->Path()->ResetMDate();
+  astr = afile->LocatorName();
+
+  if(mymap.IsBound(astr))
+    {
+      mymap(astr) = afile;
+    }
+  else
+    {
+      mymap.Bind(astr, afile);
+      return Standard_True;
+    }
+  return Standard_False;
+}
+
+//=======================================================================
+//function : ChangeRemove
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Locator::ChangeRemove(const Handle(WOKernel_File)& afile)
+{
+  Handle(TCollection_HAsciiString) astr;
+
+  afile->Path()->ResetMDate();
+  
+  astr = afile->LocatorName();
+
+  if(mymap.IsBound(astr))
+    {
+      mymap.UnBind(astr);
+      return Standard_True;
+    }
+  return Standard_False;
+}
diff --git a/src/WOKernel/WOKernel_Parcel.cdl b/src/WOKernel/WOKernel_Parcel.cdl
new file mode 100755 (executable)
index 0000000..8035a88
--- /dev/null
@@ -0,0 +1,45 @@
+-- File:       WOKernel_Parcel.cdl
+-- Created:    Fri Jun 23 17:39:49 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Parcel from WOKernel 
+inherits UnitNesting from WOKernel
+
+       ---Purpose: A parcel is  a set of development Units  delivered
+       --          from a team to another
+
+uses
+    HSequenceOfHAsciiString from TColStd,
+    HAsciiString            from TCollection,
+    Warehouse               from WOKernel,
+    FileType                from WOKernel,
+    File                    from WOKernel,
+    HSequenceOfParamItem    from WOKUtils
+    
+is
+    Create(aname : HAsciiString from TCollection; anesting : Warehouse from  WOKernel)  
+       returns mutable Parcel  from  WOKernel; 
+    
+    EntityCode(me) 
+       returns HAsciiString from TCollection
+       is redefined;
+
+    GetUnitList(me:mutable)
+       returns HSequenceOfHAsciiString from TColStd
+       is redefined private;
+
+    GetUnitListFile(me)
+       returns File from WOKernel
+       is redefined private;
+
+    Delivery(me) returns HAsciiString from TCollection;
+    
+    Open(me: mutable)  is redefined;
+    Close(me: mutable) is redefined;
+
+fields
+    mydelivery : HAsciiString from TCollection;
+end Parcel;
diff --git a/src/WOKernel/WOKernel_Parcel.cxx b/src/WOKernel/WOKernel_Parcel.cxx
new file mode 100755 (executable)
index 0000000..b725581
--- /dev/null
@@ -0,0 +1,151 @@
+// File:       WOKernel_Parcel.cxx
+// Created:    Wed Jul 26 18:39:20 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <fstream.h>
+
+#include <Standard_ProgramError.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_AdmFile.hxx>
+
+
+#include <WOKernel_File.hxx>
+#include <WOKernel_FileType.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_Session.hxx>
+
+#include <WOKernel_Parcel.ixx>
+
+//=======================================================================
+//function : WOKernel_Parcel
+//purpose  : instantiates a parcel
+//=======================================================================
+WOKernel_Parcel::WOKernel_Parcel(const Handle(TCollection_HAsciiString)& aname, 
+                                const Handle(WOKernel_Warehouse)& anesting) 
+  : WOKernel_UnitNesting(aname, anesting)
+{
+}
+
+
+//=======================================================================
+//function : EntityCode
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Parcel::EntityCode() const 
+{
+  static Handle(TCollection_HAsciiString) acode = new TCollection_HAsciiString("parcel");
+  return acode;
+}
+
+//=======================================================================
+//function : Deliveries
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Parcel::Delivery() const
+{
+  return mydelivery;
+}
+
+//=======================================================================
+//function : GetUnitList
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Parcel::GetUnitList() 
+{
+  Handle(TColStd_HSequenceOfHAsciiString) units = new TColStd_HSequenceOfHAsciiString;
+  Handle(TColStd_HSequenceOfHAsciiString) delseq;
+
+  mydelivery = EvalParameter("Delivery", Standard_True);
+
+  if(!mydelivery.IsNull())
+    {
+      Handle(WOKernel_File) allcomps = GetUnitListFile();
+      allcomps->GetPath();
+
+      Standard_Character                        typecode;
+      Handle(WOKernel_DevUnit)                  unit;
+      Handle(WOKernel_File)                     afile;
+      Handle(TCollection_HAsciiString)          astr;
+
+      
+      ifstream astream(allcomps->Path()->Name()->ToCString(), ios::in);
+      char namebuf[1024];
+      
+      while(astream >> typecode >> setw(1024) >> namebuf)
+       {
+         astr = new TCollection_HAsciiString(namebuf);
+         
+         unit = GetDevUnit(typecode, astr);
+         
+         if(unit.IsNull() == Standard_True)
+           {
+             ErrorMsg << "WOKernel_Parcel::GetUnitList" 
+                      << "Unknown type code (" << typecode << ") in " 
+                      << allcomps->Path()->Name() <<  " of " << Name() << endm;
+             Standard_ProgramError::Raise("WOKernel_Parcel::GetUnitList");
+           }
+         
+         units->Append(unit->FullName());
+         Session()->AddEntity(unit);
+         typecode = 0;
+         *namebuf = '\0';
+       }
+      astream.close();
+    }
+
+  return units;
+}
+
+//=======================================================================
+//function : Open
+//purpose  : opens parcel
+//=======================================================================
+void WOKernel_Parcel::Open()
+{
+  if(IsOpened()) return;
+
+  Reset();
+
+  GetParams();
+
+  WOKernel_UnitNesting::Open();
+
+  SetOpened();
+}
+
+//=======================================================================
+//function : Close
+//purpose  : closes parcel
+//=======================================================================
+void WOKernel_Parcel::Close()
+{
+  if(!IsOpened()) return;
+  WOKernel_UnitNesting::Close();
+  mydelivery.Nullify();
+  Reset();
+  SetClosed();
+}
+
+
+Handle(WOKernel_File) WOKernel_Parcel::GetUnitListFile() const
+{
+  Handle(WOKernel_File) allcomps;
+
+  if(!mydelivery.IsNull())
+    {
+      
+      Handle(TCollection_HAsciiString) aname = new TCollection_HAsciiString(mydelivery);
+      aname->AssignCat(Params().Eval("%FILENAME_AllComponentsSuffix"));
+      
+      allcomps = new WOKernel_File(aname, this, GetFileType("UnitListFile"));
+    }
+  return allcomps;
+}
diff --git a/src/WOKernel/WOKernel_Session.cdl b/src/WOKernel/WOKernel_Session.cdl
new file mode 100755 (executable)
index 0000000..960da59
--- /dev/null
@@ -0,0 +1,177 @@
+-- File:       WOKernel_Session.cdl
+-- Created:    Fri Jun 23 17:16:37 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Session from WOKernel 
+inherits Entity from WOKernel
+
+       ---Purpose: A WOK user session 
+       --          Manages WOK process lifetime
+
+uses
+    HSequenceOfHAsciiString from TColStd,
+    HAsciiString            from TCollection,
+    BaseEntity              from WOKernel,
+    DBMSID                  from WOKernel,
+    StationID               from WOKernel,
+    Factory                 from WOKernel,
+    Warehouse               from WOKernel,
+    Workshop                from WOKernel,
+    UnitNesting             from WOKernel,
+    Workbench               from WOKernel,
+    Parcel                  from WOKernel,
+    DevUnit                 from WOKernel,
+    File                    from WOKernel,
+    Entity                  from WOKernel,
+    DataMapOfHAsciiStringOfFactory   from WOKernel,
+    DataMapOfHAsciiStringOfWarehouse from WOKernel,
+    DataMapOfHAsciiStringOfWorkshop  from WOKernel,
+    DataMapOfHAsciiStringOfParcel    from WOKernel,
+    DataMapOfHAsciiStringOfWorkbench from WOKernel,
+    DataMapOfHAsciiStringOfDevUnit   from WOKernel,
+    FileTypeBase                     from WOKernel,
+    GlobalFileTypeBase               from WOKernel,
+    HSequenceOfParamItem             from WOKUtils
+
+           
+raises
+    ProgramError from Standard
+is
+    Create(aname : HAsciiString from TCollection) returns mutable Session from WOKernel;
+    ---Purpose: instantiates Session does not Open It !!!    
+
+    EntityCode(me) 
+       returns HAsciiString from TCollection
+       is redefined;
+
+    GetFileTypeBase(me; anent : Entity from WOKernel)
+       returns FileTypeBase from WOKernel;
+
+    BuildParameters(me: mutable; someparams : HSequenceOfParamItem from WOKUtils; usedefaults : Boolean from Standard)
+       returns HSequenceOfParamItem from WOKUtils is redefined;
+
+    Build(me: mutable; someparams : HSequenceOfParamItem from WOKUtils)   is redefined; 
+    ---Purpose: Nothing to do here    
+    Destroy(me: mutable) is redefined;
+    ---Purpose: Nothing either
+    
+    
+    Open(me:mutable)
+       raises ProgramError from Standard is redefined;
+    
+    Open(me: mutable; aroot, libpath : HAsciiString from TCollection)  
+    ---Purpose: Loads factory list
+       raises ProgramError from Standard;
+       
+    Close(me: mutable) is redefined;
+    ---Purpose: closes session
+    --          automatically closes opened entities in session    
+       
+    AddEntity(me:mutable; anentity : Entity from WOKernel)
+       returns Boolean from Standard;
+    ---Purpose: Adds an Entity to the map
+        
+    RemoveEntity(me:mutable; anentity : Entity from WOKernel)
+       returns Boolean from Standard;
+    ---Purpose: Removes an Entity to the map
+
+    IsKnownEntity(me; auniquename : HAsciiString from TCollection)
+    ---Purpose: Gets Entity Handle with its name
+       returns Boolean from Standard;
+
+    IsKnownEntity(me; anentity : Entity from WOKernel)
+    ---Purpose: Gets Entity Handle with its name
+       returns Boolean from Standard;
+       
+    ClearEntities(me:mutable);
+    ---Purpose: Clears Entity Map    
+       
+    -- Is Name a certain type of entity
+
+    IsFactory(me;     aname : HAsciiString from TCollection) returns Boolean from Standard; 
+    IsWarehouse(me;   aname : HAsciiString from TCollection) returns Boolean from Standard; 
+    IsWorkshop(me;    aname : HAsciiString from TCollection) returns Boolean from Standard; 
+    IsWorkbench(me;   aname : HAsciiString from TCollection) returns Boolean from Standard; 
+    IsUnitNesting(me; aname : HAsciiString from TCollection) returns Boolean from Standard;  
+    IsParcel(me;      aname : HAsciiString from TCollection) returns Boolean from Standard; 
+    IsDevUnit(me;     aname : HAsciiString from TCollection) returns Boolean from Standard;  
+
+    -- Get Entity using its name
+
+    GetEntity(me;      aname : HAsciiString from TCollection) returns Entity      from WOKernel;
+    ---C++: return const &
+    GetFactory(me;     aname : HAsciiString from TCollection) returns Factory     from WOKernel;
+    ---C++: return const &
+    GetWarehouse(me;   aname : HAsciiString from TCollection) returns Warehouse   from WOKernel;
+    ---C++: return const &
+    GetWorkshop(me;    aname : HAsciiString from TCollection) returns Workshop    from WOKernel;
+    ---C++: return const &
+    GetUnitNesting(me; aname : HAsciiString from TCollection) returns UnitNesting from WOKernel;  
+    ---C++: return const &
+    GetWorkbench(me;   aname : HAsciiString from TCollection) returns Workbench   from WOKernel;
+    ---C++: return const &
+    GetParcel(me;      aname : HAsciiString from TCollection) returns Parcel      from WOKernel;
+    ---C++: return const &
+    GetDevUnit(me;     aname : HAsciiString from TCollection) returns DevUnit     from WOKernel;
+    ---C++: return const &
+
+    GetMatchingEntities(me; aname    : HAsciiString from TCollection;
+                           fullpath : Boolean from Standard = Standard_True) 
+    ---Purpose: renvoie les entites matchant un nom ou une partie de FullNames    
+       returns HSequenceOfHAsciiString from TColStd;
+
+
+    Factories(me) 
+    ---Purpose: gives the factory sequence of Session    
+       returns HSequenceOfHAsciiString from TColStd;
+
+    DumpFactoryList(me);
+    ---Purpose: Updates files ATLIST with myfactories    
+
+    AddFactory(me:mutable; afact : Factory from WOKernel)
+    ---Purpose: Ajouter un atelier a la liste et met a jour 
+    --          le fichier ATLIST
+       raises ProgramError from Standard;
+
+    RemoveFactory(me:mutable; afact : Factory from WOKernel)
+    ---Purpose: Removes the Factory from ATLIST    
+       raises ProgramError from Standard;
+
+    SetStation(me:mutable; ast : StationID from WOKernel);
+
+    Station(me) 
+    ---C++: inline
+               returns StationID from WOKernel;
+    
+    SetDBMSystem(me:mutable; adb : DBMSID from WOKernel);
+    
+    DBMSystem(me) 
+    ---C++: inline
+       returns DBMSID from WOKernel;
+    
+    DebugMode(me)
+       returns Boolean from Standard;
+       
+    SetDebugMode(me:mutable);
+    UnsetDebugMode(me:mutable);
+    
+fields
+    mystation       : StationID                         from WOKernel;
+    mydbms          : DBMSID                            from WOKernel;
+    mydebug         : Boolean                           from Standard;
+    myfactories     : DataMapOfHAsciiStringOfFactory    from WOKernel;
+    mywarehouses    : DataMapOfHAsciiStringOfWarehouse  from WOKernel;
+    myworkshops     : DataMapOfHAsciiStringOfWorkshop   from WOKernel;
+    myparcels       : DataMapOfHAsciiStringOfParcel     from WOKernel;
+    myworkbenches   : DataMapOfHAsciiStringOfWorkbench  from WOKernel;
+    myunits         : DataMapOfHAsciiStringOfDevUnit    from WOKernel;
+    myfiletypebases : GlobalFileTypeBase                from WOKernel;
+
+friends
+
+    class EntityIterator from WOKernel
+
+end Session;
diff --git a/src/WOKernel/WOKernel_Session.cxx b/src/WOKernel/WOKernel_Session.cxx
new file mode 100755 (executable)
index 0000000..47f8543
--- /dev/null
@@ -0,0 +1,590 @@
+// File:       WOKernel_Session.cxx
+// Created:    Thu Jun 29 18:01:08 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <fstream.h>
+
+#include <WOKernel_Session.ixx>
+
+#include <WOKernel_Factory.hxx>
+#include <WOKernel_Warehouse.hxx>
+#include <WOKernel_Workshop.hxx>
+#include <WOKernel_Workbench.hxx>
+#include <WOKernel_Parcel.hxx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_File.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DataMapIteratorOfDataMapOfHAsciiStringOfFactory.hxx>
+#include <WOKernel_GlobalFileTypeBase.hxx>
+
+
+#include <WOKernel_FileTypeKeyWords.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_Path.hxx>
+
+#include <OSD_Environment.hxx>
+#include <OSD_Host.hxx>
+#include <OSD_OEMType.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+//=======================================================================
+//function : WOKernel_Session
+//purpose  : 
+//=======================================================================
+WOKernel_Session::WOKernel_Session(const Handle(TCollection_HAsciiString)& aname) 
+  : WOKernel_Entity(aname, Handle(WOKernel_Entity)()), mystation(WOKernel_UnknownStation)
+{
+  // nothing to do here
+  myfiletypebases= new WOKernel_GlobalFileTypeBase;
+}
+
+//=======================================================================
+//function : EntityCode
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Session::EntityCode() const 
+{
+  static Handle(TCollection_HAsciiString) acode = new TCollection_HAsciiString("session");
+  return acode;
+}
+
+//=======================================================================
+//function : GetFileTypeBase
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_FileTypeBase) WOKernel_Session::GetFileTypeBase(const Handle(WOKernel_Entity)& anent) const
+{
+   Handle(WOKernel_FileTypeBase) base;
+
+   if(!anent.IsNull())
+     {
+       base =  myfiletypebases->GetFileTypeBase(anent);
+   
+       if(!base.IsNull())
+        {
+          base->SetNeededArguments(anent, DBMSystem(), Station());
+        }
+     }
+   return base;
+}
+
+//=======================================================================
+//function : BuildParameters
+//purpose  : 
+//=======================================================================
+Handle(WOKUtils_HSequenceOfParamItem) WOKernel_Session::BuildParameters(const Handle(WOKUtils_HSequenceOfParamItem)& ,
+                                                                       const Standard_Boolean )
+{
+  return new WOKUtils_HSequenceOfParamItem;
+}
+
+//=======================================================================
+//function : Build
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::Build(const Handle(WOKUtils_HSequenceOfParamItem)& )
+{
+  // nothing to build
+}
+
+//=======================================================================
+//function : Destroy
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::Destroy()
+{
+  // nothing to destroy
+}
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::Open()
+{
+  if(IsOpened()) return;
+  Standard_ProgramError::Raise("WOKernel_Session::Open : Wrong Open Call for Session");
+  return;
+}
+
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::Open(const Handle(TCollection_HAsciiString)& aroot, const Handle(TCollection_HAsciiString)& woklib)
+{
+  //OSD_Environment rootadm("WOK_ROOTADMDIR");
+  //OSD_Environment woklib ("WOK_LIBPATH");
+  OSD_Host        ahost;
+  OSD_OEMType     ahosttype;
+  Handle(TCollection_HAsciiString) apath;
+  Handle(TCollection_HAsciiString) afile;
+  Handle(WOKernel_Factory) afact;
+
+  if(IsOpened()) return;
+
+  Reset();
+
+  // chargement de la table de parametres de la Session
+  if(aroot.IsNull())
+    {
+      ErrorMsg << "WOKernel_Session::Open" 
+       << "No administration root directory" << endm;
+      return;
+    }
+  else
+    {
+      Handle(WOKUtils_Path) rootpath = new WOKUtils_Path(aroot);
+      if(!rootpath->Exists())
+       {
+         ErrorMsg << "WOKernel_Session::Open" 
+           << "Administration root directory (" << aroot << ") does not exists" << endm;
+         return;
+       }
+      if(!rootpath->IsDirectory())
+       {
+         ErrorMsg << "WOKernel_Session::Open" 
+           << "Administration root directory (" << aroot << ") is not a directory" << endm;
+         return;
+       }
+    }
+
+  Params().Set("%WOKSESSION_Adm", aroot->ToCString());
+
+  // chargement de la librarie WOK
+  if(woklib.IsNull())
+    {
+      ErrorMsg << "WOKernel_Session::Open" << "No File search path" << endm;
+      return;
+    }
+
+  Params().Set("%WOKSESSION_WokLibPath", woklib->ToCString());
+
+  GetParams();
+
+  ahosttype = ahost.MachineType();
+  
+  if(ahost.Failed()) ahost.Perror();
+  
+  WOKernel_StationID thestation;
+
+  switch(ahosttype)
+    {
+    case OSD_SUN:
+      thestation = WOKernel_SUN;
+      break;
+    case OSD_DEC:
+      thestation = WOKernel_DECOSF;
+      break;
+    case OSD_SGI:
+      thestation = WOKernel_SGI;
+      break;
+    case OSD_HP:
+      thestation = WOKernel_HP;
+      break;
+    case OSD_MAC:
+      thestation = WOKernel_MAC;
+      break;
+    case OSD_PC:
+      thestation = WOKernel_WNT;
+      break;
+    default:
+      ErrorMsg << "WOKernel_Session::Open" << "Unrecognized Type of host " << ahost.HostName().ToCString() << endm;
+      Standard_Failure::Raise("WOKernel_Session::Open");
+    }
+
+  Params().Set((Standard_CString)LOCALARCHVAR, WOKernel_Station::GetName(thestation)->ToCString());
+
+  if(mystation==WOKernel_UnknownStation)
+    {
+      mystation =  thestation;
+    }
+
+  // chargement de l'ATLISTFILE
+  afile = EvalParameter("ATListFile");
+
+  if(afile.IsNull() == Standard_True)
+    {
+      ErrorMsg << "WOKernel_Session::Open" << "Parameter %WOKSESSION_ATListFile not set" << endm;
+      Standard_ProgramError::Raise("WOKernel_Session::Open");
+    }
+  
+  ifstream astream(afile->ToCString(), ios::in);
+  char inbuf[1024];
+
+  *inbuf = '\0';
+  while(astream >> setw(1024) >> inbuf)
+    {
+      afact = new WOKernel_Factory(new TCollection_HAsciiString(inbuf), this);
+      AddEntity(afact);
+      *inbuf = '\0';
+    }
+
+  SetOpened();
+  return;
+}
+
+//=======================================================================
+//function : Close
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::Close()
+{
+  if(!IsOpened()) return;
+  ClearEntities();
+  Reset();
+  SetClosed();
+}
+
+
+
+//=======================================================================
+//function : AddEntity
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Session::AddEntity(const Handle(WOKernel_Entity)& anentity)
+{
+  const Handle(TCollection_HAsciiString)& astr = anentity->FullName();
+
+  if(myunits.IsBound(astr)       ||
+     myworkbenches.IsBound(astr) || 
+     myparcels.IsBound(astr)     ||
+     myworkshops.IsBound(astr)   ||
+     mywarehouses.IsBound(astr)  ||
+     myfactories.IsBound(astr)
+     )
+    return Standard_False;
+  
+  if(anentity->IsKind(STANDARD_TYPE(WOKernel_DevUnit)))   {myunits.Bind(astr,*((Handle(WOKernel_DevUnit) *) &anentity));return Standard_True;}
+  if(anentity->IsKind(STANDARD_TYPE(WOKernel_Workbench))) {myworkbenches.Bind(astr,*((Handle(WOKernel_Workbench) *) &anentity));return Standard_True;}
+  if(anentity->IsKind(STANDARD_TYPE(WOKernel_Parcel)))    {myparcels.Bind(astr,*((Handle(WOKernel_Parcel) *) &anentity));return Standard_True;}
+  if(anentity->IsKind(STANDARD_TYPE(WOKernel_Workshop)))  {myworkshops.Bind(astr,*((Handle(WOKernel_Workshop) *) &anentity));return Standard_True;}
+  if(anentity->IsKind(STANDARD_TYPE(WOKernel_Warehouse))) {mywarehouses.Bind(astr,*((Handle(WOKernel_Warehouse) *) &anentity));return Standard_True;}
+  if(anentity->IsKind(STANDARD_TYPE(WOKernel_Factory)))   {myfactories.Bind(astr,*((Handle(WOKernel_Factory) *) &anentity));return Standard_True;}
+  return Standard_False;
+}
+
+
+//=======================================================================
+//function : RemoveEntity
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Session::RemoveEntity(const Handle(WOKernel_Entity)& anentity)
+{
+  const Handle(TCollection_HAsciiString)&  aname = anentity->FullName();
+  if(myunits.IsBound(aname))       myunits.UnBind(aname);
+  if(myworkbenches.IsBound(aname)) myworkbenches.UnBind(aname);
+  if(myparcels.IsBound(aname))     myparcels.UnBind(aname);
+  if(myworkshops.IsBound(aname))   myworkshops.UnBind(aname);
+  if(mywarehouses.IsBound(aname))  mywarehouses.UnBind(aname);
+  if(myfactories.IsBound(aname))   myfactories.UnBind(aname);
+  return Standard_True;
+}
+
+//=======================================================================
+//function : IsKnownEntity
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Session::IsKnownEntity(const Handle(TCollection_HAsciiString)& auniquename) const 
+{
+  if(myunits.IsBound(auniquename))       return Standard_True;
+  if(myworkbenches.IsBound(auniquename)) return Standard_True;
+  if(myparcels.IsBound(auniquename))     return Standard_True;
+  if(myworkshops.IsBound(auniquename))   return Standard_True;
+  if(mywarehouses.IsBound(auniquename))  return Standard_True;
+  if(myfactories.IsBound(auniquename))   return Standard_True;
+  return Standard_False;
+}
+
+//=======================================================================
+//function : IsKnownEntity
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Session::IsKnownEntity(const Handle(WOKernel_Entity)& anentity) const 
+{
+  if(myunits.IsBound(anentity->FullName()))       return Standard_True;
+  if(myworkbenches.IsBound(anentity->FullName())) return Standard_True;
+  if(myparcels.IsBound(anentity->FullName()))     return Standard_True;
+  if(myworkshops.IsBound(anentity->FullName()))   return Standard_True;
+  if(mywarehouses.IsBound(anentity->FullName()))  return Standard_True;
+  if(myfactories.IsBound(anentity->FullName()))   return Standard_True;
+  return Standard_False;
+}
+
+//=======================================================================
+//function : ClearEntities
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::ClearEntities()
+{
+  myfactories.Clear();
+  mywarehouses.Clear();
+  myworkshops.Clear();
+  myparcels.Clear();
+  myworkbenches.Clear();
+  myunits.Clear();
+}
+
+//=======================================================================
+//function : IsTHETYPE
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Session::IsFactory(const Handle(TCollection_HAsciiString)& aname) const 
+{return myfactories.IsBound(aname);}
+
+Standard_Boolean WOKernel_Session::IsWarehouse(const Handle(TCollection_HAsciiString)& aname) const 
+{return mywarehouses.IsBound(aname);}
+
+Standard_Boolean WOKernel_Session::IsWorkshop(const Handle(TCollection_HAsciiString)& aname) const 
+{return myworkshops.IsBound(aname);}
+
+Standard_Boolean WOKernel_Session::IsUnitNesting(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  if( myparcels.IsBound(aname)) return Standard_True;
+  return myworkbenches.IsBound(aname);
+}
+
+Standard_Boolean WOKernel_Session::IsWorkbench(const Handle(TCollection_HAsciiString)& aname) const 
+{return myworkbenches.IsBound(aname);}
+
+Standard_Boolean WOKernel_Session::IsParcel(const Handle(TCollection_HAsciiString)& aname) const 
+{return myparcels.IsBound(aname);}
+
+Standard_Boolean WOKernel_Session::IsDevUnit(const Handle(TCollection_HAsciiString)& aname) const 
+{return myunits.IsBound(aname);}
+
+//=======================================================================
+//function : GetTHETYPE
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_Entity)& WOKernel_Session::GetEntity(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_Entity) NULLRESULT;
+  
+  if(aname.IsNull()) return NULLRESULT;
+  
+  if(myunits.IsBound(aname))       return myunits.Find(aname);
+  if(myworkbenches.IsBound(aname)) return myworkbenches.Find(aname);
+  if(myparcels.IsBound(aname))     return myparcels.Find(aname);
+  if(myworkshops.IsBound(aname))   return myworkshops.Find(aname);
+  if(mywarehouses.IsBound(aname))  return mywarehouses.Find(aname);
+  if(myfactories.IsBound(aname))   return myfactories.Find(aname);
+  if(!strcmp(aname->ToCString(), ":")) 
+    {
+      static Handle(WOKernel_Entity) ME = this;
+      ME = this;
+      return ME;
+    }
+  return NULLRESULT;
+}
+
+const Handle(WOKernel_Factory)& WOKernel_Session::GetFactory(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_Factory) NULLRESULT;
+  if(myfactories.IsBound(aname)) return myfactories.Find(aname);
+  return NULLRESULT;
+}
+
+const Handle(WOKernel_Warehouse)& WOKernel_Session::GetWarehouse(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_Warehouse) NULLRESULT;
+  if(mywarehouses.IsBound(aname)) return mywarehouses.Find(aname);
+  return NULLRESULT;
+}
+
+const Handle(WOKernel_Workshop)& WOKernel_Session::GetWorkshop(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_Workshop) NULLRESULT;
+  if(myworkshops.IsBound(aname)) return myworkshops.Find(aname);
+  return NULLRESULT;
+}
+
+const Handle(WOKernel_UnitNesting)& WOKernel_Session::GetUnitNesting(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_UnitNesting) NULLRESULT;
+  if(myparcels.IsBound(aname))     return myparcels.Find(aname);
+  if(myworkbenches.IsBound(aname)) return myworkbenches.Find(aname);
+  return NULLRESULT;
+}
+
+const Handle(WOKernel_Workbench)& WOKernel_Session::GetWorkbench(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_Workbench) NULLRESULT;
+  if(myworkbenches.IsBound(aname)) return myworkbenches.Find(aname);
+  return NULLRESULT;
+}
+
+const Handle(WOKernel_Parcel)& WOKernel_Session::GetParcel(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_Parcel) NULLRESULT;
+  if(myparcels.IsBound(aname)) return myparcels.Find(aname);
+  return NULLRESULT;
+}
+
+const Handle(WOKernel_DevUnit)& WOKernel_Session::GetDevUnit(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  static Handle(WOKernel_DevUnit) NULLRESULT;
+  if(myunits.IsBound(aname)) return myunits.Find(aname);
+  return NULLRESULT;
+}
+
+//=======================================================================
+//function : GetMatchingEntities
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Session::GetMatchingEntities(const Handle(TCollection_HAsciiString)& aname,
+                                                                             const Standard_Boolean fullpath) const 
+{
+  WOKernel_EntityIterator anit(this);
+  Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+
+  while(anit.More())
+    {
+      if(fullpath)
+       {
+         if(!strcmp(anit.Key()->ToCString(),aname->ToCString()))
+           {
+             aseq->Append(anit.Key());
+           }
+       }
+      else
+       { 
+         Standard_Integer pos = anit.Key()->Search(aname);
+         if(pos >1)
+           {
+             if(pos == anit.Key()->Length()-aname->Length()+1 && anit.Key()->Value(pos-1)==':')
+               {
+                 aseq->Append(anit.Key());
+               }
+           }
+       }
+      anit.Next();
+    }
+
+  return aseq;
+}
+
+//=======================================================================
+//function : Factories
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Session::Factories() const 
+{
+  Handle(TColStd_HSequenceOfHAsciiString) factories = new TColStd_HSequenceOfHAsciiString;
+
+  WOKernel_DataMapIteratorOfDataMapOfHAsciiStringOfFactory anit(myfactories);
+
+  while(anit.More())
+    {
+      factories->Append(anit.Key());
+      anit.Next();
+    }
+
+  return factories;
+}
+
+
+//=======================================================================
+//function : DumpFactoryList
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::DumpFactoryList() const
+{
+  Handle(TCollection_HAsciiString) anatlist, aname;
+  anatlist = EvalParameter("ATListFile");
+  ofstream astream(anatlist->ToCString(), ios::out);
+  
+  if(!astream)
+    {
+      ErrorMsg << "WOKernel_Session::AddFactory" << "Could not open " << anatlist << endm;
+      Standard_ProgramError::Raise("WOKernel_Session::AddFactory");
+    }
+  
+  WOKernel_DataMapIteratorOfDataMapOfHAsciiStringOfFactory anit(myfactories);
+  while(anit.More())
+    {
+      astream << anit.Value()->Name()->ToCString() << endl;
+      anit.Next();
+    }
+  return;
+}
+
+//=======================================================================
+//function : AddFactory
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::AddFactory(const Handle(WOKernel_Factory)& afact)
+{
+  if(Session()->IsKnownEntity(afact->FullName()))
+    {
+      ErrorMsg << "WOKernel_Session::AddFactory" << "There is already an entity named " << afact->FullName() << endm;
+      Standard_ProgramError::Raise("WOKernel_Session::AddFactory");
+    }
+
+  AddEntity(afact);
+  DumpFactoryList();
+  return;
+}
+
+//=======================================================================
+//function : RemoveFactory
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::RemoveFactory(const Handle(WOKernel_Factory)& afact)
+{
+  if(myfactories.IsBound(afact->FullName())) myfactories.UnBind(afact->FullName());
+  DumpFactoryList();
+  return;
+
+}
+
+//=======================================================================
+//function : SetStation
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::SetStation(const WOKernel_StationID ast)
+{
+  mystation = ast;
+}
+
+//=======================================================================
+//function : SetDBMSystem
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::SetDBMSystem(const WOKernel_DBMSID adb)
+{
+  mydbms = adb;
+}
+
+//=======================================================================
+//function : DebugMode
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_Session::DebugMode() const
+{
+  return mydebug;
+}
+
+//=======================================================================
+//function : SetDebugMode
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::SetDebugMode() 
+{
+  mydebug = Standard_True;
+}
+
+//=======================================================================
+//function : UnSetDebugMode
+//purpose  : 
+//=======================================================================
+void WOKernel_Session::UnsetDebugMode() 
+{
+  mydebug = Standard_False;
+}
+
diff --git a/src/WOKernel/WOKernel_Session.lxx b/src/WOKernel/WOKernel_Session.lxx
new file mode 100755 (executable)
index 0000000..d72e617
--- /dev/null
@@ -0,0 +1,14 @@
+// File:       WOKernel_Session.lxx
+// Created:    Wed Jul 26 18:35:45 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+inline WOKernel_StationID WOKernel_Session::Station() const
+{
+  return mystation;
+}
+
+inline WOKernel_DBMSID WOKernel_Session::DBMSystem() const
+{
+  return mydbms;
+}
diff --git a/src/WOKernel/WOKernel_Station.cdl b/src/WOKernel/WOKernel_Station.cdl
new file mode 100755 (executable)
index 0000000..1fb0267
--- /dev/null
@@ -0,0 +1,35 @@
+-- File:       WOKernel_Station.cdl
+-- Created:    Fri Jul 28 16:27:09 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Station from WOKernel 
+
+       ---Purpose: Manages Stations Operations
+
+uses
+    StationID             from WOKernel,
+    HSequenceOfStationID  from WOKernel,
+    HAsciiString          from TCollection
+    
+raises
+    ProgramError        from Standard
+is
+
+    GetID(myclass; astring : HAsciiString from TCollection) 
+       returns StationID    from WOKernel
+       raises  ProgramError from Standard;
+
+    IsNameKnown(myclass; astring : HAsciiString from TCollection) 
+       returns Boolean from Standard;
+       
+    GetName(myclass; anid : StationID from WOKernel)
+       returns HAsciiString from TCollection;
+
+    GetHSeqOfStation(myclass; astr : HAsciiString from TCollection)
+       returns HSequenceOfStationID from WOKernel
+       raises  ProgramError from Standard;
+
+end Station;
diff --git a/src/WOKernel/WOKernel_Station.cxx b/src/WOKernel/WOKernel_Station.cxx
new file mode 100755 (executable)
index 0000000..c695513
--- /dev/null
@@ -0,0 +1,103 @@
+// File:       WOKernel_Station.cxx
+// Created:    Fri Jul 28 17:28:32 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+
+#include <WOKernel_Station.ixx>
+
+#include <WOKTools_Messages.hxx>
+
+//=======================================================================
+//function : GetID
+//purpose  : Gives the ID of a station name
+//=======================================================================
+WOKernel_StationID WOKernel_Station::GetID(const Handle(TCollection_HAsciiString)& astring)
+{
+  if( !strcmp( astring->ToCString(), "sun" ) )  return WOKernel_SUN;
+  if( !strcmp( astring->ToCString(), "ao1" ) )  return WOKernel_DECOSF;
+  if( !strcmp( astring->ToCString(), "sil" ) )  return WOKernel_SGI;
+  if( !strcmp( astring->ToCString(), "hp"  ) )  return WOKernel_HP;
+  if( !strcmp( astring->ToCString(), "wnt" ) )  return WOKernel_WNT;
+  if( !strcmp( astring->ToCString(), "mac" ) )  return WOKernel_MAC;
+
+  ErrorMsg << "WOKernel_Station::GetID" << "Station " << astring << " is unknown to WOK" << endm;
+  Standard_ProgramError::Raise("WOKernel_Station::GetID");
+  return WOKernel_UnknownStation;
+}
+
+//=======================================================================
+//function : IsNameKnown
+//purpose  : Gives the ID of a station name
+//=======================================================================
+Standard_Boolean WOKernel_Station::IsNameKnown(const Handle(TCollection_HAsciiString)& astring)
+{
+  if( !strcmp( astring->ToCString(), "sun" ) )  return Standard_True;
+  if( !strcmp( astring->ToCString(), "ao1" ) )  return Standard_True;
+  if( !strcmp( astring->ToCString(), "sil" ) )  return Standard_True;
+  if( !strcmp( astring->ToCString(), "hp"  ) )  return Standard_True;
+  if( !strcmp( astring->ToCString(), "wnt" ) )  return Standard_True;
+  if( !strcmp( astring->ToCString(), "mac" ) )  return Standard_True;
+
+  return Standard_False;
+}
+
+//=======================================================================
+//function : GetName
+//purpose  : Gives the name of a station id
+//=======================================================================
+ Handle(TCollection_HAsciiString) WOKernel_Station::GetName(const WOKernel_StationID anid)
+{
+  static Handle(TCollection_HAsciiString) SSUN     = new TCollection_HAsciiString("sun");
+  static Handle(TCollection_HAsciiString) SDECOSF  = new TCollection_HAsciiString("ao1");
+  static Handle(TCollection_HAsciiString) SSGI     = new TCollection_HAsciiString("sil");
+  static Handle(TCollection_HAsciiString) SHP      = new TCollection_HAsciiString("hp");
+  static Handle(TCollection_HAsciiString) SWNT     = new TCollection_HAsciiString("wnt");
+  static Handle(TCollection_HAsciiString) SMAC     = new TCollection_HAsciiString("mac");
+  static Handle(TCollection_HAsciiString) SUNKNOWN = new TCollection_HAsciiString("UnknownStation");
+
+  switch(anid)
+    {
+    case WOKernel_SUN: 
+      return SSUN;
+    case WOKernel_DECOSF: 
+      return SDECOSF;
+    case WOKernel_SGI: 
+      return SSGI;
+    case WOKernel_HP: 
+      return SHP;
+    case WOKernel_WNT: 
+      return SWNT;
+    case WOKernel_MAC: 
+      return SMAC;
+    default:
+      break;
+    }
+  return SUNKNOWN;
+}
+
+//=======================================================================
+//function : GetHSeqOfStation
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_HSequenceOfStationID) WOKernel_Station::GetHSeqOfStation(const Handle(TCollection_HAsciiString)& astr)
+{
+  Standard_Integer i = 2;
+  Handle(TCollection_HAsciiString) thestr;
+  Handle(WOKernel_HSequenceOfStationID) aseq = new WOKernel_HSequenceOfStationID;
+
+  if(astr.IsNull())   return aseq;
+  if(astr->IsEmpty()) return aseq;
+  
+  thestr = astr->Token();
+
+  while(thestr->IsEmpty() == Standard_False)
+    {
+      if(IsNameKnown(thestr))
+       {
+         aseq->Append(WOKernel_Station::GetID(thestr));
+       }
+      thestr = astr->Token(" \t", i++);
+    }
+  return aseq;
+}
diff --git a/src/WOKernel/WOKernel_UnitGraph.cdl b/src/WOKernel/WOKernel_UnitGraph.cdl
new file mode 100755 (executable)
index 0000000..4e5b479
--- /dev/null
@@ -0,0 +1,45 @@
+-- File:       WOKernel_UnitGraph.cdl
+-- Created:    Mon Jan  8 18:16:01 1996
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1996
+
+
+class UnitGraph from WOKernel 
+inherits TShared from MMgt
+
+       ---Purpose: 
+
+uses
+    Locator                  from WOKernel,
+    Workbench                from WOKernel,
+    HAsciiString             from TCollection,
+    HSequenceOfHAsciiString  from TColStd,
+    DataMapOfHAsciiStringOfHSequenceOfHAsciiString from WOKTools
+    
+is
+
+    Create(awb : Workbench from WOKernel)  returns mutable UnitGraph from WOKernel;
+
+    Create(alocator : Locator from WOKernel)  returns mutable UnitGraph from WOKernel;
+
+    Contains(me; aname : HAsciiString from TCollection)
+       returns Boolean from Standard;
+
+    Add(me : mutable; aname : HAsciiString from TCollection; suppliers : HSequenceOfHAsciiString  from TColStd);
+    
+    Add(me : mutable; aname : HAsciiString from TCollection; asupplier : HAsciiString  from TCollection);
+    
+    Remove(me:mutable;     aname : HAsciiString from TCollection);
+    
+    Suppliers(me; aname : HAsciiString from TCollection)
+    ---C++: return const &
+         returns HSequenceOfHAsciiString  from TColStd;
+       
+    Locator(me) returns Locator from WOKernel;
+
+fields
+    mylocator : Locator     from WOKernel;
+    myUDMap   : DataMapOfHAsciiStringOfHSequenceOfHAsciiString from WOKTools;
+    
+end UnitGraph;
diff --git a/src/WOKernel/WOKernel_UnitGraph.cxx b/src/WOKernel/WOKernel_UnitGraph.cxx
new file mode 100755 (executable)
index 0000000..9304dc9
--- /dev/null
@@ -0,0 +1,99 @@
+// File:       WOKernel_UnitGraph.cxx
+// Created:    Tue Jan  9 16:39:33 1996
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+#include <WOKernel_UnitGraph.ixx>
+
+
+//=======================================================================
+//function : WOKernel_UnitGraph
+//purpose  : 
+//=======================================================================
+ WOKernel_UnitGraph::WOKernel_UnitGraph(const Handle(WOKernel_Workbench)& awb)
+{
+  mylocator = new WOKernel_Locator(awb);
+}
+
+//=======================================================================
+//function : WOKernel_UnitGraph
+//purpose  : 
+//=======================================================================
+ WOKernel_UnitGraph::WOKernel_UnitGraph(const Handle(WOKernel_Locator)& alocator)
+: mylocator(alocator)
+
+{
+}
+
+//=======================================================================
+//function : Add
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitGraph::Add(const Handle(TCollection_HAsciiString)& aname,
+                            const Handle(TColStd_HSequenceOfHAsciiString)& suppliers)
+{
+  if (!myUDMap.IsBound(aname))
+    myUDMap.Bind(aname,suppliers);
+}
+
+//=======================================================================
+//function : Add
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitGraph::Add(const Handle(TCollection_HAsciiString)& aname,
+                            const Handle(TCollection_HAsciiString)& supplier)
+{
+  if (!myUDMap.IsBound(aname))
+    myUDMap.Bind(aname,new TColStd_HSequenceOfHAsciiString);
+
+  const Handle(TColStd_HSequenceOfHAsciiString)& aseq = myUDMap.Find(aname);
+
+  if(!aseq.IsNull()) aseq->Append(supplier);
+}
+
+//=======================================================================
+//function : Remove
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitGraph::Remove(const Handle(TCollection_HAsciiString)& aname)
+{
+  if (myUDMap.IsBound(aname))
+    myUDMap.UnBind(aname);
+}
+
+//=======================================================================
+//function : Suppliers
+//purpose  : 
+//=======================================================================
+const Handle(TColStd_HSequenceOfHAsciiString)& WOKernel_UnitGraph::Suppliers(const Handle(TCollection_HAsciiString)& aname) const
+{
+  if (myUDMap.IsBound(aname)) {
+    return myUDMap.Find(aname);
+  }
+  else {
+    static Handle(TColStd_HSequenceOfHAsciiString) res;
+    return res;
+  }
+}
+
+//=======================================================================
+//function : Contains
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_UnitGraph::Contains(const Handle(TCollection_HAsciiString)& aname) const 
+{
+  return myUDMap.IsBound(aname);
+}
+
+//=======================================================================
+//function : Locator
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_Locator) WOKernel_UnitGraph::Locator() const
+{
+  return mylocator;
+}
+
+
diff --git a/src/WOKernel/WOKernel_UnitNesting.cdl b/src/WOKernel/WOKernel_UnitNesting.cdl
new file mode 100755 (executable)
index 0000000..a6a8a72
--- /dev/null
@@ -0,0 +1,70 @@
+
+-- -- File:    WOKernel_UnitNesting.cdl
+-- Created:    Fri Jun 23 18:31:37 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+deferred class UnitNesting from WOKernel 
+inherits Entity from WOKernel
+
+       ---Purpose: 
+
+uses
+    Entity                  from WOKernel,
+    DevUnit                 from WOKernel,
+    HSequenceOfDBMSID       from WOKernel,
+    HSequenceOfStationID    from WOKernel,
+    UnitTypeBase            from WOKernel,
+    FileType                from WOKernel,
+    FileTypeBase            from WOKernel,
+    File                    from WOKernel,
+    Path                    from WOKUtils,
+    HSequenceOfParamItem    from WOKUtils,
+    HAsciiString            from TCollection,
+    HSequenceOfHAsciiString from TColStd
+
+raises
+    ProgramError from Standard
+is
+    Initialize(aname : HAsciiString from TCollection; anesting : Entity from WOKernel);
+
+    GetUnitList(me:mutable)
+       returns HSequenceOfHAsciiString from TColStd
+       is deferred private;
+
+    GetUnitListFile(me)
+       returns File from WOKernel
+       is deferred private;
+
+    Open(me: mutable)  
+       raises ProgramError from Standard;
+
+    Close(me: mutable);
+   
+    Units(me) 
+       returns HSequenceOfHAsciiString from TColStd is static;
+
+    DumpUnitList(me) is static private;
+
+    GetDevUnit(me; akey : Character from Standard; aname : HAsciiString from TCollection)
+       returns DevUnit from WOKernel;
+       
+    GetDevUnit(me; atype, aname : HAsciiString from TCollection)
+       returns DevUnit from WOKernel;
+
+    KnownTypes(me) 
+    ---C++: return const &
+               returns UnitTypeBase from WOKernel;
+
+    AddUnit(me:mutable; aunit : DevUnit from WOKernel) 
+       raises ProgramError from Standard is static;
+
+    RemoveUnit(me:mutable; aunit : DevUnit from WOKernel) 
+       raises ProgramError from Standard is static;
+
+fields
+    mytypebase : UnitTypeBase                  from WOKernel;
+    myunits    : HSequenceOfHAsciiString       from TColStd;
+end UnitNesting;
diff --git a/src/WOKernel/WOKernel_UnitNesting.cxx b/src/WOKernel/WOKernel_UnitNesting.cxx
new file mode 100755 (executable)
index 0000000..208dbf7
--- /dev/null
@@ -0,0 +1,232 @@
+// File:       WOKernel_UnitNesting.cxx
+// Created:    Wed Jul 26 18:41:59 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <fstream.h>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_MapOfHAsciiString.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_ParamItem.hxx>
+
+#include <WOKernel_Session.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_File.hxx>
+#include <WOKernel_HSequenceOfDBMSID.hxx>
+#include <WOKernel_HSequenceOfStationID.hxx>
+#include <WOKernel_DataMapIteratorOfDataMapOfFileType.hxx>
+
+#include <WOKernel_UnitNesting.ixx>
+
+//=======================================================================
+//function : WOKernel_UnitNesting
+//purpose  : Intialize UN
+//=======================================================================
+WOKernel_UnitNesting::WOKernel_UnitNesting(const Handle(TCollection_HAsciiString)& aname, 
+                                          const Handle(WOKernel_Entity)& anesting) 
+  : WOKernel_Entity(aname, anesting)
+{
+}
+
+
+//=======================================================================
+//function : Open
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitNesting::Open()
+{
+  if(IsOpened()) return;
+  {
+    Handle(TColStd_HSequenceOfHAsciiString)   aseq;
+    Handle(TCollection_HAsciiString)          astr;
+
+    // UnitTypeBase  
+    if(mytypebase.LoadBase(Params())) return;
+
+    SetFileTypeBase(Session()->GetFileTypeBase(this));
+
+    // chargement de la liste des uds
+    myunits = GetUnitList();
+    
+    SetOpened();
+  }
+  return;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : GetDevUnit
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_DevUnit) WOKernel_UnitNesting::GetDevUnit(const Standard_Character akey, 
+                                                         const Handle(TCollection_HAsciiString)& aname) const
+{
+  Handle(WOKernel_UnitTypeDescr) atype = mytypebase.GetTypeDescr(akey);
+  Handle(WOKernel_DevUnit) result;
+
+  if(atype.IsNull())
+    {
+      ErrorMsg << "WOKernel_UnitNesting::GetDevUnit"
+              << "Could not find appropriate unit type for key : " << akey << endm;
+      return result;
+    }
+  
+  if(aname.IsNull())
+    {
+      ErrorMsg << "WOKernel_UnitNesting::GetDevUnit"
+              << "Invalid unit name (null)" << endm;
+      return result;
+    }
+  
+  result = new WOKernel_DevUnit(atype, aname, this);
+  return result;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : GetDevUnit
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_DevUnit) WOKernel_UnitNesting::GetDevUnit(const Handle(TCollection_HAsciiString)& atype, 
+                                                         const Handle(TCollection_HAsciiString)& aname) const
+{
+  Handle(WOKernel_UnitTypeDescr) thetype = mytypebase.GetTypeDescr(atype);
+  Handle(WOKernel_DevUnit) result;
+
+  if(thetype.IsNull())
+    {
+      ErrorMsg << "WOKernel_UnitNesting::GetDevUnit"
+              << "Could not find appropriate unit type for type : " << atype << endm;
+      return result;
+    }
+  
+  if(aname.IsNull())
+    {
+      ErrorMsg << "WOKernel_UnitNesting::GetDevUnit"
+              << "Invalid unit name (null)" << endm;
+      return result;
+    }
+  
+  result = new WOKernel_DevUnit(thetype, aname, this);
+  return result;
+}
+
+//=======================================================================
+//function : Close
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitNesting::Close()
+{
+  if(!IsOpened()) return;
+
+  Handle(WOKernel_DevUnit) aunit;
+  Standard_Integer i;
+
+  for(i=1; i<=myunits->Length(); i++)
+    {
+      aunit = Session()->GetDevUnit(myunits->Value(i));
+      aunit->Close();
+      Session()->RemoveEntity(aunit);
+    }
+  myunits.Nullify();
+  mytypebase.Clear();
+  Reset();
+  SetClosed();
+}
+
+//=======================================================================
+//function : Units
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_UnitNesting::Units() const 
+{
+  return myunits;
+}
+
+//=======================================================================
+//function : DumpUnitList
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitNesting::DumpUnitList() const
+{
+  Standard_Integer i;
+  Handle(WOKernel_File) afile;
+
+  afile = GetUnitListFile();
+  afile->GetPath();
+
+  ofstream astream(afile->Path()->Name()->ToCString(), ios::out);
+  
+  if(!astream)
+    {
+      ErrorMsg << "WOKernel_UnitNesting::AddUnit" << "Could not open " << afile->Path()->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_Workshop::AddWorkbench");
+    }
+  
+  for(i = 1 ; i <= myunits->Length() ; i++)
+    {
+      Handle(WOKernel_DevUnit) aunit = Session()->GetDevUnit(myunits->Value(i));
+      astream << aunit->TypeCode() << " " << aunit->Name()->ToCString() << endl;
+    }
+  return;
+  
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : KnownTypes
+//purpose  : 
+//=======================================================================
+const WOKernel_UnitTypeBase& WOKernel_UnitNesting::KnownTypes() const
+{
+  return mytypebase;
+}
+
+//=======================================================================
+//function : AddUnit
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitNesting::AddUnit(const Handle(WOKernel_DevUnit)& aunit)
+{
+  if(Session()->IsKnownEntity(aunit)) 
+    {
+      ErrorMsg << "WOKernel_UnitNesting::AddUnit" << "There is already a unit called " << aunit->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_UnitNesting::AddUnit");
+    }
+
+  myunits->Append(aunit->FullName());
+  Session()->AddEntity(aunit);
+  
+  DumpUnitList();
+  return;
+}
+
+
+
+//=======================================================================
+//function : RemoveUnit
+//purpose  : removes a unit in the list of units (i.e. updates UDLIST)
+//=======================================================================
+void WOKernel_UnitNesting::RemoveUnit(const Handle(WOKernel_DevUnit)& aunit)
+{
+  Standard_Integer i;
+  
+  for(i = 1 ; i <= myunits->Length() ; i++)
+    {
+      if(myunits->Value(i)->IsSameString(aunit->FullName()))
+       {myunits->Remove(i);break;}
+    }
+  Session()->RemoveEntity(aunit);
+  DumpUnitList();
+  return;
+}
+
+
diff --git a/src/WOKernel/WOKernel_UnitTypeBase.cdl b/src/WOKernel/WOKernel_UnitTypeBase.cdl
new file mode 100755 (executable)
index 0000000..d85f83f
--- /dev/null
@@ -0,0 +1,48 @@
+-- File:       WOKernel_UnitTypeBase.cdl
+-- Created:    Fri Jun  6 17:11:01 1997
+-- Author:     Jean GAUTIER
+--             <jga@hourax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1997
+
+
+class UnitTypeBase from WOKernel 
+
+       ---Purpose: 
+
+uses
+    HAsciiString            from TCollection,
+    Param                   from WOKUtils,
+    UnitTypeDescr           from WOKernel,
+    SequenceOfUnitTypeDescr from WOKernel
+
+is
+
+    Create
+       returns UnitTypeBase from WOKernel;
+    
+    Clear(me:out);
+    
+    LoadBase(me : out; params : Param from WOKUtils)
+    ---Purpose: Loads known file type base
+       returns Boolean from Standard;
+       
+    GetTypeDescr(me;akey  : Character from Standard)
+    ---C++: return const &
+       returns UnitTypeDescr from WOKernel;
+       
+    GetTypeDescr(me;atype : HAsciiString from TCollection)
+    ---C++: return const &
+       returns UnitTypeDescr from WOKernel;
+
+    Length(me)
+       returns Integer from Standard;
+
+    Value(me; anidx : Integer from Standard)
+    ---C++: return const &
+       returns UnitTypeDescr from WOKernel;
+
+fields
+
+    mytypes : SequenceOfUnitTypeDescr from WOKernel;
+
+end UnitTypeBase;
diff --git a/src/WOKernel/WOKernel_UnitTypeBase.cxx b/src/WOKernel/WOKernel_UnitTypeBase.cxx
new file mode 100755 (executable)
index 0000000..1772ae3
--- /dev/null
@@ -0,0 +1,137 @@
+// File:       WOKernel_UnitTypeBase.cxx
+// Created:    Mon Jun  9 10:50:41 1997
+// Author:     Jean GAUTIER
+//             <jga@hourax.paris1.matra-dtv.fr>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_Param.hxx>
+
+#include <WOKernel_UnitTypeBase.ixx>
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : WOKernel_UnitTypeBase
+//purpose  : 
+//=======================================================================
+WOKernel_UnitTypeBase::WOKernel_UnitTypeBase()
+{
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Clear
+//purpose  : 
+//=======================================================================
+void WOKernel_UnitTypeBase::Clear() 
+{
+  mytypes.Clear();
+}
+
+
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : LoadBase
+//purpose  : 
+//=======================================================================
+Standard_Boolean WOKernel_UnitTypeBase::LoadBase(const WOKUtils_Param& params) 
+{
+  
+  Handle(TCollection_HAsciiString) types = params.Eval("%WOKEntity_UnitTypes");
+
+  if(types.IsNull())
+    {
+      ErrorMsg << "WOKernel_UnitTypeBase::LoadBase" 
+              << "Could not eval parameter %WOKEntity_UnitTypes : unit types cannot be loaded" << endm;
+      return Standard_True;
+    }
+
+  Handle(TCollection_HAsciiString) atype = types->Token(" \t", 1);
+  Standard_Integer i = 1;
+  Standard_Boolean status = Standard_False;
+
+  while(!atype->IsEmpty())
+    {
+
+      Handle(TCollection_HAsciiString) akeyvar = new TCollection_HAsciiString("%WOKEntity_");
+      akeyvar->AssignCat(atype);
+      akeyvar->AssignCat("_Key");
+
+      Handle(TCollection_HAsciiString) akey = params.Eval(akeyvar->ToCString());
+
+      if(akey.IsNull())
+       {
+         ErrorMsg << "WOKernel_UnitTypeBase::LoadBase" 
+                  << "Type " << atype << " with no key is ignored" << endm;
+         status = Standard_True;
+       }
+      else
+       {
+         Handle(WOKernel_UnitTypeDescr) thetype = new WOKernel_UnitTypeDescr(akey->Value(1), atype);
+         
+         mytypes.Append(thetype);
+       }
+
+      i++;
+      atype = types->Token(" \t", i);
+    }
+  return status;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : GetTypeDescr
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_UnitTypeDescr)& WOKernel_UnitTypeBase::GetTypeDescr(const Standard_Character akey) const
+{
+  static Handle(WOKernel_UnitTypeDescr) NULLRESULT;
+
+  for(Standard_Integer i=1; i<=mytypes.Length(); i++)
+    {
+      const Handle(WOKernel_UnitTypeDescr)& adescr = mytypes.Value(i);
+      if ( adescr->Key() == akey ) return adescr;
+    }
+  return NULLRESULT;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : GetTypeDescr
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_UnitTypeDescr)& WOKernel_UnitTypeBase::GetTypeDescr(const Handle(TCollection_HAsciiString)& atype) const
+{
+  static Handle(WOKernel_UnitTypeDescr) NULLRESULT;
+
+  for(Standard_Integer i=1; i<=mytypes.Length(); i++)
+    {
+      const Handle(WOKernel_UnitTypeDescr)& adescr = mytypes.Value(i);
+      if ( adescr->Type()->IsSameString(atype) ) return adescr;
+    }
+  return NULLRESULT;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Length
+//purpose  : 
+//=======================================================================
+Standard_Integer WOKernel_UnitTypeBase::Length() const 
+{
+  return mytypes.Length();
+}
+
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Value
+//purpose  : 
+//=======================================================================
+const Handle(WOKernel_UnitTypeDescr)& WOKernel_UnitTypeBase::Value(const Standard_Integer anidx) const
+{
+  return mytypes.Value(anidx);
+}
diff --git a/src/WOKernel/WOKernel_UnitTypeDescr.cdl b/src/WOKernel/WOKernel_UnitTypeDescr.cdl
new file mode 100755 (executable)
index 0000000..d024aa5
--- /dev/null
@@ -0,0 +1,34 @@
+-- File:       WOKernel_UnitTypeDescr.cdl
+-- Created:    Fri Jun  6 16:41:02 1997
+-- Author:     Jean GAUTIER
+--             <jga@hourax.paris1.matra-dtv.fr>
+---Copyright:   Matra Datavision 1997
+
+
+class    UnitTypeDescr from WOKernel 
+inherits TShared from MMgt
+
+       ---Purpose: 
+
+uses
+    HAsciiString from TCollection
+
+is
+
+    Create(akey : Character from Standard; atype : HAsciiString from TCollection)
+       returns mutable UnitTypeDescr from WOKernel;
+    
+    Key(me) returns Character from Standard;
+    ---C++: inline
+
+    Type(me) returns HAsciiString from TCollection;
+    ---C++: inline
+    ---C++: return const &
+
+    
+fields
+
+    mykey  : Character from Standard;
+    mytype : HAsciiString from TCollection;
+
+end UnitTypeDescr;
diff --git a/src/WOKernel/WOKernel_UnitTypeDescr.cxx b/src/WOKernel/WOKernel_UnitTypeDescr.cxx
new file mode 100755 (executable)
index 0000000..8502dee
--- /dev/null
@@ -0,0 +1,18 @@
+// File:       WOKernel_UnitTypeDescr.cxx
+// Created:    Fri Jun  6 16:56:43 1997
+// Author:     Jean GAUTIER
+//             <jga@hourax.paris1.matra-dtv.fr>
+
+#include <WOKernel_UnitTypeDescr.ixx>
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : WOKernel_UnitTypeDescr
+//purpose  : 
+//=======================================================================
+WOKernel_UnitTypeDescr::WOKernel_UnitTypeDescr(const Standard_Character akey,
+                                              const Handle(TCollection_HAsciiString)& atype) 
+: mykey(akey), mytype(atype)
+{
+}
+
diff --git a/src/WOKernel/WOKernel_UnitTypeDescr.lxx b/src/WOKernel/WOKernel_UnitTypeDescr.lxx
new file mode 100755 (executable)
index 0000000..dc49824
--- /dev/null
@@ -0,0 +1,27 @@
+// File:       WOKernel_UnitTypeDescr.lxx
+// Created:    Fri Jun  6 16:57:48 1997
+// Author:     Jean GAUTIER
+//             <jga@hourax.paris1.matra-dtv.fr>
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Key
+//purpose  : 
+//=======================================================================
+inline  Standard_Character WOKernel_UnitTypeDescr::Key() const
+{
+  return mykey;
+}
+
+//=======================================================================
+//Author   : Jean Gautier (jga)
+//function : Type
+//purpose  : 
+//=======================================================================
+inline const Handle(TCollection_HAsciiString)& WOKernel_UnitTypeDescr::Type() const
+{
+  return mytype;
+}
+
diff --git a/src/WOKernel/WOKernel_Warehouse.cdl b/src/WOKernel/WOKernel_Warehouse.cdl
new file mode 100755 (executable)
index 0000000..2f38392
--- /dev/null
@@ -0,0 +1,42 @@
+-- File:       WOKernel_Warehouse.cdl
+-- Created:    Fri Jun 23 17:21:52 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Warehouse from WOKernel 
+inherits Entity from WOKernel
+       ---Purpose: Warehouse contains parcels used by the workshops 
+       --          of the factory
+
+uses
+    HSequenceOfHAsciiString from TColStd,
+    HAsciiString            from TCollection,
+    Entity                  from WOKernel,
+    Parcel                  from WOKernel,
+    Factory                 from WOKernel,
+    HSequenceOfParamItem    from WOKUtils
+is
+    Create(aname : HAsciiString from TCollection; anesting : Factory from  WOKernel)  
+       returns mutable Warehouse  from  WOKernel; 
+    
+    EntityCode(me) 
+       returns HAsciiString from TCollection
+       is redefined;
+
+    Open(me: mutable)  is redefined;
+    Close(me: mutable) is redefined;
+    AddParcel(me:mutable; aparcel : Parcel from WOKernel);
+    RemoveParcel(me:mutable; aparcel : Parcel from WOKernel);
+
+    Parcels(me) 
+       returns HSequenceOfHAsciiString from TColStd;
+     
+    DumpParcelList(me)
+    is private;
+
+fields
+    myparcels : HSequenceOfHAsciiString from TColStd;
+end Warehouse;
diff --git a/src/WOKernel/WOKernel_Warehouse.cxx b/src/WOKernel/WOKernel_Warehouse.cxx
new file mode 100755 (executable)
index 0000000..0e420d5
--- /dev/null
@@ -0,0 +1,196 @@
+// File:       WOKernel_Warehouse.cxx
+// Created:    Wed Jul 26 18:18:27 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <fstream.h>
+
+#include <TCollection_HAsciiString.hxx>
+
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+
+#include <WOKTools_Messages.hxx>
+
+#include <WOKUtils_AdmFile.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_ParamItem.hxx>
+#include <WOKUtils_HSequenceOfParamItem.hxx>
+
+#include <Standard_ProgramError.hxx>
+
+#include <WOKernel_Session.hxx>
+#include <WOKernel_Parcel.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_File.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_HSequenceOfDBMSID.hxx>
+#include <WOKernel_HSequenceOfStationID.hxx>
+
+#include <WOKernel_Warehouse.ixx>
+
+//=======================================================================
+//function : WOKernel_Warehouse
+//purpose  : instantiates a Warehouse
+//=======================================================================
+WOKernel_Warehouse::WOKernel_Warehouse(const Handle(TCollection_HAsciiString)& aname, 
+                                      const Handle(WOKernel_Factory)& anesting) 
+  : WOKernel_Entity(aname, anesting) 
+{
+}
+
+//=======================================================================
+//function : EntityCode
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Warehouse::EntityCode() const 
+{
+  static Handle(TCollection_HAsciiString) acode = new TCollection_HAsciiString("warehouse");
+  return acode;
+}
+
+//=======================================================================
+//function : Open
+//purpose  : opens the warehouse
+//=======================================================================
+void WOKernel_Warehouse::Open()
+{
+  if(IsOpened()) return;
+  {
+    Reset();
+
+    Handle(TColStd_HSequenceOfHAsciiString) aseq;
+    Handle(WOKernel_Parcel) aparcel;
+    Standard_Integer i;
+
+    GetParams();
+    SetFileTypeBase(Session()->GetFileTypeBase(this));
+
+    Handle(WOKernel_File) parcellist = new WOKernel_File(this, GetFileType("ParcelListFile"));
+
+    parcellist->GetPath();
+
+    WOKUtils_AdmFile afile(parcellist->Path());
+
+    aseq = afile.Read();
+
+    
+    myparcels = new TColStd_HSequenceOfHAsciiString;
+
+    for(i=1 ; i <= aseq->Length() ; i++)
+      {
+       aparcel = new WOKernel_Parcel( aseq->Value(i), Handle(WOKernel_Warehouse)(this));
+       myparcels->Append(aparcel->FullName());
+       Session()->AddEntity(aparcel);
+      }
+
+    SetOpened();
+  }
+  return;
+}
+
+//=======================================================================
+//function : Close
+//purpose  : closes Warehouse and Nested Entities
+//=======================================================================
+void WOKernel_Warehouse::Close()
+{
+  if(!IsOpened()) return;
+
+  Standard_Integer i;
+  Handle(WOKernel_Parcel) aparcel;
+
+  for(i=1; i<=myparcels->Length(); i++)
+    {
+      aparcel = Session()->GetParcel(myparcels->Value(i));
+      if (!aparcel.IsNull()) {
+       aparcel->Close();
+       Session()->RemoveEntity(aparcel);
+      }
+    }
+  Reset();
+  SetClosed();
+  return;
+}
+
+//=======================================================================
+//function : AddParcel
+//purpose  : 
+//=======================================================================
+void WOKernel_Warehouse::AddParcel(const Handle(WOKernel_Parcel)& aparcel)
+{
+  if(Session()->IsKnownEntity(aparcel)) 
+    {
+      ErrorMsg << "WOKernel_Warehouse::AddParcel" << "There is already a parcel called " << aparcel->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_Warehouse::AddParcel");
+    }
+
+
+
+  myparcels->Append(aparcel->FullName());
+  Session()->AddEntity(aparcel);
+  
+  DumpParcelList();
+}
+
+//=======================================================================
+//function : RemoveParcel
+//purpose  : 
+//=======================================================================
+void WOKernel_Warehouse::RemoveParcel(const Handle(WOKernel_Parcel)& aparcel)
+{
+  Standard_Integer i;
+  
+  for(i = 1 ; i <= myparcels->Length() ; i++)
+    {
+      if(myparcels->Value(i)->IsSameString(aparcel->FullName()))
+       {myparcels->Remove(i);break;}
+    }
+  Session()->RemoveEntity(aparcel);
+
+  
+  DumpParcelList();
+}
+
+//=======================================================================
+//function : Parcels
+//purpose  : Gives the list of available parcels in warehouse
+//=======================================================================
+ Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Warehouse::Parcels() const 
+{
+  return myparcels;
+}
+
+
+//=======================================================================
+//function : DumpParcelList
+//purpose  : 
+//=======================================================================
+void WOKernel_Warehouse::DumpParcelList() const
+{
+  Handle(WOKernel_File) theparcellist = new WOKernel_File(this,GetFileType("ParcelListFile"));
+  theparcellist->GetPath();
+  Handle(WOKUtils_Path) theparcellistpath = theparcellist->Path();
+  if (!theparcellistpath->IsWriteAble()) {
+    ErrorMsg << "WOKernel_Warehouse::DumpParcelList"
+      << "Enable to modify file " << theparcellistpath->Name() << endm;
+    Standard_ProgramError::Raise("WOKernel_Warehouse::DumpParcelList");
+  }
+  else {
+    fstream theparcellistfile(theparcellistpath->Name()->ToCString(),ios::out);
+    if ( theparcellistfile.good() ) {
+      for (Standard_Integer i=1; i<= myparcels->Length(); i++) {
+       Handle(WOKernel_Parcel) aparcel = Session()->GetParcel(myparcels->Value(i));
+       theparcellistfile << aparcel->Name()->ToCString() << endl;
+      }
+    }
+    else {
+      ErrorMsg << "WOKernel_Parcel::DumpParcelList"
+       << "Enable to access file " << theparcellistpath->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_Warehouse::DumpParcelList");
+    } 
+  }
+}
+
+
diff --git a/src/WOKernel/WOKernel_Workbench.cdl b/src/WOKernel/WOKernel_Workbench.cdl
new file mode 100755 (executable)
index 0000000..8b3ad08
--- /dev/null
@@ -0,0 +1,66 @@
+-- File:       WOKernel_Workbench.cdl
+-- Created:    Fri Jun 23 17:49:24 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Workbench from WOKernel 
+inherits UnitNesting from WOKernel
+
+       ---Purpose: a workbench is the developing Environment of a developper
+
+uses
+    HAsciiString                from TCollection,
+    Workshop                    from WOKernel,
+    FileType                    from WOKernel,
+    File                        from WOKernel,
+    Locator                     from WOKernel,
+    HSequenceOfParamItem        from WOKUtils,
+    HSequenceOfHAsciiString     from TColStd
+
+raises
+    ProgramError from Standard
+is
+
+    Create(aname : HAsciiString from TCollection; anesting : Workshop from WOKernel; afather : Workbench from WOKernel)   
+    ---Purpose: Instantiates a workbench    
+       returns mutable Workbench from  WOKernel; 
+    
+    GetParameters(me:mutable)
+    is redefined protected;
+
+    EntityCode(me) 
+       returns HAsciiString from TCollection
+       is redefined;
+
+    GetUnitList(me:mutable)
+       returns HSequenceOfHAsciiString from TColStd
+       is redefined private;
+
+    GetUnitListFile(me)
+       returns File from WOKernel
+       is redefined private;
+
+    Open(me: mutable)
+    ---Purpose: Opens an existing Workbench    
+       raises ProgramError from Standard is redefined; 
+       
+    Close(me: mutable) is redefined;
+    ---Purpose: Closes an Opened Workbench
+     
+    Father(me) returns mutable HAsciiString from TCollection;
+    ---Purpose: Gives the Father Workbench of me    
+    
+    SetFather(me:mutable; afather : Workbench from WOKernel);
+    ---Purpose: Set the father of Wb    
+    
+    Ancestors(me) returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: Gives the ancestors of me
+
+    Visibility(me) returns HSequenceOfHAsciiString from TColStd;
+    ---Purpose: Gives The nestings in visibility of workbench    
+
+fields
+    myfather     : HAsciiString from TCollection;
+end Workbench;
diff --git a/src/WOKernel/WOKernel_Workbench.cxx b/src/WOKernel/WOKernel_Workbench.cxx
new file mode 100755 (executable)
index 0000000..7d25d6f
--- /dev/null
@@ -0,0 +1,275 @@
+// File:       WOKernel_Workbench.cxx
+// Created:    Wed Jul 26 18:27:19 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <fstream.h>
+
+#include <WOKernel_Workbench.ixx>
+
+#include <WOKernel_Session.hxx>
+#include <WOKernel_Station.hxx>
+#include <WOKernel_DBMSystem.hxx>
+#include <WOKernel_DevUnit.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_File.hxx>
+
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_ParamItem.hxx>
+#include <WOKUtils_Path.hxx>
+#include <WOKTools_Messages.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+//=======================================================================
+//function : WOKernel_Workbench
+//purpose  : instantiates a Workbench
+//=======================================================================
+WOKernel_Workbench::WOKernel_Workbench(const Handle(TCollection_HAsciiString)& aname, 
+                                      const Handle(WOKernel_Workshop)& anesting,
+                                      const Handle(WOKernel_Workbench)& afather) 
+: WOKernel_UnitNesting(aname, anesting)
+{
+  if(afather.IsNull() == Standard_False)
+    myfather = afather->FullName();
+}
+
+//=======================================================================
+//function : GetParameters
+//purpose  :  
+//=======================================================================
+void WOKernel_Workbench::GetParameters()
+{
+  Standard_Integer i;
+  Handle(TColStd_HSequenceOfAsciiString) aseq;
+  Handle(TColStd_HSequenceOfAsciiString) subclasses = new TColStd_HSequenceOfAsciiString;
+  Handle(TColStd_HSequenceOfAsciiString) dirs       = new TColStd_HSequenceOfAsciiString;
+  Handle(TCollection_HAsciiString) astr;
+  Handle(TCollection_HAsciiString) libdir;
+  Handle(WOKernel_Entity) entity;
+  
+  if(!Nesting().IsNull())
+    {
+      // Entites quelconques
+      
+      entity = Session()->GetEntity(Nesting());
+      
+      aseq = entity->Params().SubClasses();
+      if(!aseq.IsNull())
+       {
+         for(i=1; i<=aseq->Length(); i++)
+           {
+             subclasses->Append(aseq->Value(i));
+           }
+       }
+      
+      aseq =  entity->Params().SearchDirectories();
+      if(!aseq.IsNull())
+       {
+         for(i=1; i<=aseq->Length(); i++)
+           {
+             dirs->Append(aseq->Value(i));
+           }
+       }
+      ChangeParams().SetSubClasses(subclasses);
+      ChangeParams().SetSearchDirectories(dirs);
+
+      // on evalue le ADM des ancetres
+      Handle(TColStd_HSequenceOfHAsciiString) ances = Ancestors();
+      Handle(WOKernel_Workbench) wb;
+      for (Standard_Integer i= ances->Length(); i > 0 ; i--) {
+       wb = Session()->GetWorkbench(ances->Value(i));
+       if (!wb.IsNull()) {
+         Params().SubClasses()->Append(wb->Name()->ToCString());
+         Handle(TCollection_HAsciiString) astr = wb->EvalParameter("Adm", Standard_False);
+         
+         if(!astr.IsNull()) {
+           dirs->Prepend(astr->ToCString());
+           TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+           lastsub.AssignCat("@");
+           lastsub.AssignCat(astr->String());
+         }
+       }
+      }
+      ChangeParams().SetSubClasses(subclasses);
+      ChangeParams().SetSearchDirectories(dirs);
+    }
+
+}  
+
+
+//=======================================================================
+//function : EntityCode
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Workbench::EntityCode() const 
+{
+  static Handle(TCollection_HAsciiString) acode = new TCollection_HAsciiString("workbench");
+  return acode;
+}
+
+//=======================================================================
+//function : GetUnitList
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Workbench::GetUnitList() 
+{
+  Standard_Character                        typecode;
+  Handle(WOKernel_DevUnit)                  unit;
+  Handle(WOKernel_File)                     afile;
+  Handle(TCollection_HAsciiString)          astr;
+  Handle(TColStd_HSequenceOfHAsciiString)   units;
+
+  units = new TColStd_HSequenceOfHAsciiString;
+
+  afile = GetUnitListFile();
+  afile->GetPath();
+
+  ifstream astream(afile->Path()->Name()->ToCString(), ios::in);
+  char namebuf[1024];
+
+  typecode = 0;
+  *namebuf = '\0';
+
+  while(astream >> typecode >> setw(1024) >> namebuf)
+    {
+      astr = new TCollection_HAsciiString(namebuf);
+
+      unit = GetDevUnit(typecode, astr);
+
+      if(unit.IsNull() == Standard_True)
+       {
+         ErrorMsg << "WOKernel_UnitNesting::Open" << "Unknown type code (" << typecode << ") in UNITLIST of " << Name() << endm;
+         Standard_ProgramError::Raise("WOKernel_UnitNesting::Open");
+       }
+
+      units->Append(unit->FullName());
+      Session()->AddEntity(unit);
+      typecode = 0;
+      *namebuf = '\0';
+    }
+  astream.close();
+  return units;
+}
+
+
+//=======================================================================
+//function : Open
+//purpose  : opens a Wb
+//=======================================================================
+void WOKernel_Workbench::Open()
+{
+  if(IsOpened()) return;
+  {
+
+    Handle(WOKernel_Workbench) afather;
+
+
+    // Ouverture des wb ancetres d'abord (recusivement)
+    if(!Father().IsNull()) 
+      {
+       afather= Session()->GetWorkbench(Father()); 
+       afather->Open();
+
+      }
+
+    
+    GetParams();
+
+    // Ouverture Nesting
+    WOKernel_UnitNesting::Open();
+
+    SetOpened();
+  }
+}
+
+//=======================================================================
+//function : Close
+//purpose  : 
+//=======================================================================
+void WOKernel_Workbench::Close()
+{
+  if(!IsOpened()) return;
+  WOKernel_UnitNesting::Close();
+  SetClosed();
+  return;
+}
+
+//=======================================================================
+//function : Father
+//purpose  : returns WB's father
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Workbench::Father() const 
+{
+  return myfather;
+}
+
+//=======================================================================
+//function : SetFather
+//purpose  : Sets the father of Wb
+//=======================================================================
+void WOKernel_Workbench::SetFather(const Handle(WOKernel_Workbench)& afather) 
+{
+  myfather = afather->FullName();
+
+  
+}
+
+//=======================================================================
+//function : Ancestors
+//purpose  : returns WB ancestors
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Workbench::Ancestors() const 
+{
+  Handle(WOKernel_Workbench) wb = Handle(WOKernel_Workbench)(this);
+  Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+
+  
+  while(wb.IsNull() == Standard_False)
+    {
+      aseq->Append(wb->FullName());
+      wb = Session()->GetWorkbench(wb->Father());
+    }
+
+  return aseq;
+}
+
+
+//=======================================================================
+//function : Visibility
+//purpose  : 
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Workbench::Visibility() const
+{
+  Standard_Integer i;
+  Handle(TColStd_HSequenceOfHAsciiString) aseq = new TColStd_HSequenceOfHAsciiString;
+  Handle(WOKernel_Workbench) abench = this;
+  
+  // l'heritage des workbenchs
+  while(!abench.IsNull())
+    {
+      aseq->Append(abench->FullName());
+      abench = Session()->GetWorkbench(abench->Father());
+    }
+
+  // les parcels
+  Handle(WOKernel_Workshop) ashop = Session()->GetWorkshop(Nesting());
+  Handle(TColStd_HSequenceOfHAsciiString) parcelseq = ashop->ParcelsInUse();
+  for( i=1; i<=parcelseq->Length(); i++)
+    {
+      aseq->Append(parcelseq->Value(i));
+    }
+  return aseq;
+}
+
+//=======================================================================
+//function : GetUnitListFile
+//purpose  : 
+//=======================================================================
+Handle(WOKernel_File) WOKernel_Workbench::GetUnitListFile() const
+{
+  return new WOKernel_File(this, GetFileType("UnitListFile"));
+}
diff --git a/src/WOKernel/WOKernel_Workshop.cdl b/src/WOKernel/WOKernel_Workshop.cdl
new file mode 100755 (executable)
index 0000000..10cabab
--- /dev/null
@@ -0,0 +1,82 @@
+-- File:       WOKernel_Workshop.cdl
+-- Created:    Fri Jun 23 17:43:57 1995
+-- Author:     Jean GAUTIER
+--             <jga@cobrax>
+---Copyright:   Matra Datavision 1995
+
+
+class Workshop from WOKernel 
+inherits Entity from WOKernel
+
+       ---Purpose: a workshop is a tree of workbench
+       --          It is used to work under a particular Parcel config
+       --          for a particuliar job       
+       --          A worshop implies a root workbench in it
+
+uses
+    HSequenceOfHAsciiString from TColStd,
+    HAsciiString            from TCollection,
+    HSequenceOfStationID    from WOKernel,
+    HSequenceOfDBMSID       from WOKernel,
+    FileTypeBase            from WOKernel,
+    Factory                 from WOKernel,
+    Workbench               from WOKernel,
+    HSequenceOfParamItem    from WOKUtils
+raises
+    ProgramError from Standard
+is
+    Create(aname : HAsciiString from TCollection; anesting : Factory from  WOKernel)  
+       returns mutable Workshop from  WOKernel; 
+
+    BuildParameters(me: mutable; someparams : HSequenceOfParamItem from WOKUtils; usedefaults : Boolean from Standard)
+    ---Purpose: constructs Sequence of Parameters Needed by Entity
+    --          to be built.
+    --          Checks their consistancy
+       returns HSequenceOfParamItem from WOKUtils is redefined;
+
+    GetParameters(me:mutable)
+    is redefined protected;
+
+    EntityCode(me) 
+       returns HAsciiString from TCollection
+       is redefined;
+    
+    GetWorkbenches(me:mutable);
+    ---Purpose: Fills Workbench List    
+    
+    GetParcelsInUse(me:mutable);
+    ---Purpose: Fills Parcel List
+
+    Open(me: mutable)  is redefined;
+    Close(me: mutable) is redefined;
+
+    Workbenches(me)  
+       returns HSequenceOfHAsciiString from TColStd;
+
+    ParcelsInUse(me) 
+       returns HSequenceOfHAsciiString from TColStd;
+               
+    SupportedStations(me)
+    ---Purpose: Retourne les Stations Supportees par l'ilot    
+       returns HSequenceOfStationID from WOKernel;
+       
+    SetSupportedStations(me : mutable; stations : HSequenceOfStationID from WOKernel); 
+    ---Purpose: Change la liste des Stations supportees    
+
+    DumpWorkbenchList(me);
+    ---Purpose: updates Workbench List    
+
+    AddWorkbench(me:mutable; aworkbench : Workbench from WOKernel)
+    ---Purpose: Adds a wb to the workshop
+       raises ProgramError from Standard;
+
+    RemoveWorkbench(me:mutable; aworkbench : Workbench from WOKernel)
+    ---Purpose: Removes a wb to the workshop
+       raises ProgramError from Standard;
+
+fields
+    myworkbenches  : HSequenceOfHAsciiString from TColStd;
+    myparcelsinuse : HSequenceOfHAsciiString from TColStd;
+    mystations     : HSequenceOfHAsciiString from TColStd;
+    mydbms         : HSequenceOfDBMSID    from WOKernel;
+end Workshop;
diff --git a/src/WOKernel/WOKernel_Workshop.cxx b/src/WOKernel/WOKernel_Workshop.cxx
new file mode 100755 (executable)
index 0000000..72c9a57
--- /dev/null
@@ -0,0 +1,452 @@
+// File:       WOKernel_Workshop.cxx
+// Created:    Wed Jul 26 15:20:50 1995
+// Author:     Jean GAUTIER
+//             <jga@cobrax>
+
+#include <fstream.h>
+
+#include <WOKernel_Workshop.ixx>
+
+#include <WOKernel_Parcel.hxx>
+#include <WOKernel_Warehouse.hxx>
+#include <WOKernel_Workbench.hxx>
+#include <WOKernel_Session.hxx>
+#include <WOKernel_FileTypeBase.hxx>
+#include <WOKernel_File.hxx>
+
+#include <WOKTools_Messages.hxx>
+#include <WOKUtils_Param.hxx>
+#include <WOKUtils_ParamItem.hxx>
+#include <WOKUtils_Path.hxx>
+#include <WOKUtils_AdmFile.hxx>
+
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfHAsciiString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+
+//=======================================================================
+//function : WOKernel_Workshop
+//purpose  : instantiates a Workshop (does not open It
+//=======================================================================
+WOKernel_Workshop::WOKernel_Workshop(const Handle(TCollection_HAsciiString)& aname, 
+                                    const Handle(WOKernel_Factory)& anesting) 
+: WOKernel_Entity(aname, anesting)
+{
+}
+
+//=======================================================================
+//function : BuildParameters
+//purpose  : 
+//=======================================================================
+Handle(WOKUtils_HSequenceOfParamItem) WOKernel_Workshop::BuildParameters(const Handle(WOKUtils_HSequenceOfParamItem)& someparams,
+                                                                        const Standard_Boolean usedefaults) 
+{
+  Handle(WOKUtils_HSequenceOfParamItem) resparams = WOKernel_Entity::BuildParameters(someparams, usedefaults);
+  TCollection_AsciiString nameparam = "%";
+  nameparam += Name()->ToCString();
+  nameparam += "_UseConfig";
+
+  Standard_Boolean found = Standard_False;
+  for (Standard_Integer i=1; (i<= someparams->Length()) && !found; i++) {
+    if (!strcmp(someparams->Value(i).Name()->ToCString(),nameparam.ToCString())) {
+      InfoMsg << "WOKernel_Workshop::BuildParameters"
+       << "Use configuration " << someparams->Value(i).Value() << endm;
+      resparams->Append(someparams->Value(i));
+      WOKUtils_ParamItem aparam("%ShopName",Name()->ToCString());
+      resparams->Append(aparam);
+      found = Standard_True;
+    }
+  }
+  return resparams;
+}
+
+//=======================================================================
+//function : GetParameters
+//purpose  : 
+//=======================================================================
+void WOKernel_Workshop::GetParameters()
+{
+  Standard_Integer i;
+  Handle(TColStd_HSequenceOfAsciiString) aseq;
+  Handle(TColStd_HSequenceOfAsciiString) subclasses = new TColStd_HSequenceOfAsciiString;
+  Handle(TColStd_HSequenceOfAsciiString) dirs       = new TColStd_HSequenceOfAsciiString;
+  Handle(TCollection_HAsciiString) astr;
+  Handle(TCollection_HAsciiString) libdir;
+  Handle(WOKernel_Entity) entity;
+
+  if(!Nesting().IsNull()) {
+
+    entity = Session()->GetEntity(Nesting());
+
+    aseq = entity->Params().SubClasses();
+    if(!aseq.IsNull()) {
+      for(i=1; i<=aseq->Length(); i++) {
+       subclasses->Append(aseq->Value(i));
+      }
+    }
+
+    aseq =  entity->Params().SearchDirectories();
+    if(!aseq.IsNull()) {
+      for(i=1; i<=aseq->Length(); i++) {
+       dirs->Append(aseq->Value(i));
+      }
+    }
+
+
+    
+    // on recupere les ADM et les classes des parcels
+
+    Handle(WOKernel_Factory)   afact = Session()->GetFactory(Nesting());
+
+
+    if(!afact->Warehouse().IsNull()) {
+      Handle(WOKernel_Warehouse) aware = Session()->GetWarehouse(afact->Warehouse());
+      aware->Open();
+
+      // on recupere l'ADM du WareHouse      
+      astr = aware->EvalParameter("Adm", Standard_False);
+
+      // subclasses->Append(aware->Name()->String());
+        
+      if (!astr.IsNull()) {
+       dirs->Prepend(astr->ToCString());
+       // TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+       //lastsub.AssignCat("@");
+       //lastsub.AssignCat(astr->String());
+      }
+        
+      //ChangeParams().SetSubClasses(subclasses);
+      ChangeParams().SetSearchDirectories(dirs);
+
+      GetParcelsInUse();
+
+      Handle(TColStd_HSequenceOfHAsciiString) parcels = ParcelsInUse();
+      
+      for (i=1; i<= parcels->Length(); i++) {
+       entity = Session()->GetEntity(parcels->Value(i));
+       if (!entity.IsNull()) {
+         
+         astr = entity->EvalParameter("Delivery", Standard_False);
+         if (!astr.IsNull()) {
+           subclasses->Append(astr->ToCString());
+         }
+         astr = entity->EvalParameter("Adm", Standard_False);
+         if (!astr.IsNull()) {
+           dirs->Prepend(astr->ToCString());
+           TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+           lastsub.AssignCat("@");
+           lastsub.AssignCat(astr->String());
+         }
+       }
+      }
+    }
+
+    subclasses->Append(Name()->ToCString());
+    // on evalue le ADM
+    astr = EvalParameter("Adm", Standard_False);
+      
+    if(!astr.IsNull()) {
+      dirs->Prepend(astr->ToCString());
+      TCollection_AsciiString& lastsub = subclasses->ChangeValue(subclasses->Length());
+      lastsub.AssignCat("@");
+      lastsub.AssignCat(astr->String());
+    }
+    
+    ChangeParams().SetSubClasses(subclasses);
+    ChangeParams().SetSearchDirectories(dirs);
+  }
+}
+
+//=======================================================================
+//function : EntityCode
+//purpose  : 
+//=======================================================================
+Handle(TCollection_HAsciiString) WOKernel_Workshop::EntityCode() const 
+{
+  static Handle(TCollection_HAsciiString) acode = new TCollection_HAsciiString("workshop");
+  return acode;
+}
+
+//=======================================================================
+//function : GetWorkbenches
+//purpose  : 
+//=======================================================================
+void WOKernel_Workshop::GetWorkbenches()
+{
+  Standard_Integer i;
+  Handle(TCollection_HAsciiString) astr;
+  Handle(TCollection_HAsciiString) afather;
+  Handle(TCollection_HAsciiString) awb;
+  Handle(WOKernel_Workbench)       afatherwb;
+  Handle(WOKernel_Workbench)       awbhandle;
+  Handle(WOKernel_File)            wblistfile;
+  Handle(TColStd_HSequenceOfHAsciiString)   aseq;
+
+  wblistfile = new WOKernel_File(this, GetFileType("WorkbenchListFile"));
+  if (!wblistfile->Name().IsNull()) {
+    wblistfile->GetPath();
+
+    WOKUtils_AdmFile  afile(wblistfile->Path());
+
+    aseq = afile.Read();
+    
+    myworkbenches  = new TColStd_HSequenceOfHAsciiString;
+    
+    for(i=1; i <= aseq->Length() ; i++)
+      {
+       awb     = aseq->Value(i)->Token(" \t", 1);
+       afather = aseq->Value(i)->Token(" \t", 2);
+       
+       if(afather->IsEmpty() == Standard_True)
+         {
+           // this is a root Workbench
+           afatherwb = Session()->GetWorkbench(NestedUniqueName(afather));
+           
+           if(afatherwb.IsNull())
+             {
+               awbhandle = new WOKernel_Workbench(awb, this, Handle(WOKernel_Workbench)());
+               myworkbenches->Append(awbhandle->FullName());
+               Session()->AddEntity(awbhandle);
+             }
+         }
+       else
+         {
+           // this is a son WB
+           
+           // Recherche du pere
+           afatherwb =  Session()->GetWorkbench(NestedUniqueName(afather));
+           if(afatherwb.IsNull())
+             {
+               afatherwb = new WOKernel_Workbench(afather, this, afatherwb);
+             }
+           
+           // recherche du WB
+           awbhandle = Session()->GetWorkbench(NestedUniqueName(awb));
+           
+           if(!awbhandle.IsNull())
+             {
+               awbhandle->SetFather(afatherwb);
+             }
+           else
+             {
+               awbhandle = new WOKernel_Workbench(awb, this, afatherwb);
+               myworkbenches->Append(awbhandle->FullName());
+               Session()->AddEntity(awbhandle);
+             }
+         }
+      }
+  }
+}
+
+//=======================================================================
+//function : GetParcelsInUse
+//purpose  : 
+//=======================================================================
+void WOKernel_Workshop::GetParcelsInUse() 
+{
+  Handle(WOKernel_Factory)   afact = Session()->GetFactory(Nesting());
+  Handle(WOKernel_Warehouse) aware = Session()->GetWarehouse(afact->Warehouse());
+  Handle(WOKernel_Parcel)    aparcel;
+  Handle(WOKernel_Entity)    anent;
+  Handle(TCollection_HAsciiString) astr, parcellst, pname;
+  Standard_Integer i=1;
+
+  myparcelsinuse = new TColStd_HSequenceOfHAsciiString;
+
+  parcellst = EvalParameter("ParcelConfig", Standard_False);
+
+  if( !parcellst.IsNull() )
+    {
+      if(parcellst->UsefullLength())
+       {
+         astr = parcellst->Token(" \t", i);
+
+         while(!astr->IsEmpty())
+           {
+             aparcel.Nullify();
+
+             pname = aware->NestedUniqueName(astr);
+
+             if(Session()->IsKnownEntity(pname))
+               {
+                 anent = Session()->GetEntity(pname);
+
+                 if(anent->IsKind(STANDARD_TYPE(WOKernel_Parcel)))
+                   {
+                     aparcel = Handle(WOKernel_Parcel)::DownCast(anent);
+                   }
+                 else
+                   {
+                     ErrorMsg << "WOKernel_Workshop::GetParcelsInUse"
+                              << "Name " << astr << " is not a parcel name" << endm;
+                   }
+               }
+             else
+               {
+                 ErrorMsg << "WOKernel_Workshop::GetParcelsInUse"
+                          << "Name " << astr << " is unknown" << endm;
+               }
+
+             if(!aparcel.IsNull())
+               {
+                 aparcel->Open();
+                 myparcelsinuse->Append(aparcel->FullName());
+               }
+             i++;
+             astr =  parcellst->Token(" \t", i);
+           }
+       }
+    }
+  return;
+}
+
+//=======================================================================
+//function : Open
+//purpose  : opens the workshop to use it
+//=======================================================================
+void WOKernel_Workshop::Open()
+{
+  if(IsOpened()) return;
+  {
+    Reset();
+
+    Handle(WOKernel_FileTypeBase) abase = new WOKernel_FileTypeBase;
+
+    GetParams();
+
+    // chargement de la base des types
+    SetFileTypeBase(Session()->GetFileTypeBase(this));
+
+    GetWorkbenches();
+
+    Handle(WOKernel_Factory)   afact = Session()->GetFactory(Nesting());
+    if(!afact->Warehouse().IsNull())
+      {
+       Handle(WOKernel_Warehouse) aware = Session()->GetWarehouse(afact->Warehouse());
+       aware->Open();
+       
+       GetParcelsInUse();
+      }
+    else
+      myparcelsinuse = new TColStd_HSequenceOfHAsciiString;
+
+    SetOpened();
+  }
+}
+
+//=======================================================================
+//function : Close
+//purpose  : closes the Workshop and sub-entities
+//=======================================================================
+void WOKernel_Workshop::Close()
+{
+  if(!IsOpened()) return;
+
+  Handle(WOKernel_Workbench) abench;
+  Standard_Integer i;
+
+  for(i=1; i<=myworkbenches->Length(); i++)
+    {
+      abench = Session()->GetWorkbench(myworkbenches->Value(i));
+      abench->Close();
+      Session()->RemoveEntity(abench);
+    }
+  myworkbenches.Nullify();
+  
+  Reset();
+  SetClosed();
+}
+
+//=======================================================================
+//function : Worbenches
+//purpose  : returns the list of Workbenches of workshop
+//=======================================================================
+ Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Workshop::Workbenches() const 
+{
+  return myworkbenches;
+}
+
+//=======================================================================
+//function : ParcelsInUse
+//purpose  : returns the list of parcels the workshop uses
+//=======================================================================
+Handle(TColStd_HSequenceOfHAsciiString) WOKernel_Workshop::ParcelsInUse() const 
+{
+  return myparcelsinuse;
+}
+
+
+
+//=======================================================================
+//function : DumpWorkbenchList
+//purpose  : Updates Workbench list
+//=======================================================================
+void WOKernel_Workshop::DumpWorkbenchList() const 
+{
+  Standard_Integer i;
+  Handle(WOKernel_File) wblistfile;
+
+  wblistfile = new WOKernel_File(this, GetFileType("WorkbenchListFile"));
+  wblistfile->GetPath();
+
+  ofstream astream(wblistfile->Path()->Name()->ToCString(), ios::out);
+  
+  if(!astream)
+    {
+      ErrorMsg << "WOKernel_Workshop::AddWorkbench" << "Could not open " << wblistfile->Path()->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_Workshop::AddWorkbench");
+    }
+  
+  for(i = 1 ; i <= myworkbenches->Length() ; i++)
+    {
+      Handle(WOKernel_Workbench) abench = Session()->GetWorkbench(myworkbenches->Value(i));
+
+      astream << abench->Name()->ToCString();
+      if(abench->Father().IsNull() == Standard_False)
+       {
+         astream << " " << Session()->GetWorkbench(abench->Father())->Name()->ToCString();
+       }
+      astream << endl;
+    }
+  return;
+}
+
+
+//=======================================================================
+//function : AddWorkbench
+//purpose  : Adds a wb to the workshop (i.e. updates WBLIST)
+//=======================================================================
+void WOKernel_Workshop::AddWorkbench(const Handle(WOKernel_Workbench)& aworkbench)
+{
+  if(Session()->IsKnownEntity(aworkbench->FullName()))
+    {
+      ErrorMsg << "WOKernel_Workshop::AddWorkbench" << "There is already a workbench called " <<  aworkbench->Name() << endm;
+      Standard_ProgramError::Raise("WOKernel_Workshop::AddWorkbench");
+    }
+  myworkbenches->Append(aworkbench->FullName());
+  Session()->AddEntity(aworkbench);
+  DumpWorkbenchList();
+  return;
+}
+
+//=======================================================================
+//function : RemoveWorkbench
+//purpose  :
+//=======================================================================
+void WOKernel_Workshop::RemoveWorkbench(const Handle(WOKernel_Workbench)& aworkbench)
+{
+  Standard_Integer i;
+  
+  for(i = 1 ; i <= myworkbenches->Length() ; i++)
+    {
+      if(myworkbenches->Value(i)->IsSameString(aworkbench->FullName()))
+       {
+         myworkbenches->Remove(i);
+         break;
+       }
+    }
+  
+  Session()->RemoveEntity(aworkbench);
+  DumpWorkbenchList();
+  return;
+}