home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)gdrfile.tcl /main/titanic/1
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)gdrfile.tcl /main/titanic/1 16 Apr 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- require config.tcl
- # End user added include file section
-
-
- Class GDRFile : {GCObject} {
- constructor
- method destructor
- method read
- method write
- method edit
- method quit
- method addItemSelector
- method addFileSelector
- method fileSelectors
- method findItemSelectors
- method findItemSelector
- method itemSelectorSet
- method fileSelectorSet
- attribute customLevel
- attribute customFileVersion
- attribute description
- attribute _itemSelectorSet
- attribute _fileSelectorSet
- }
-
- constructor GDRFile {class this customFileVersion} {
- set this [GCObject::constructor $class $this]
- $this customFileVersion $customFileVersion
- $this _itemSelectorSet [List new]
- $this _fileSelectorSet [List new]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method GDRFile::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method GDRFile::read {this} {
- set tmpFile [BasicFS::tmpFile]
- [$this customFileVersion] downLoad $tmpFile
- set file [open $tmpFile]
-
- # get description
- set description ""
- if [[$this customFileVersion] isA RepositoryObject] {
- set description [[$this customFileVersion] getPropertyValue freeText]
- }
- if { $description == "" } {
- set contents [read $file]
- seek $file 0
- regexp {Description:([ -z]*)} $contents dummy description
- set description [string trim $description]
- }
- $this description $description
-
- while { [get_config_line $file line] != -1 } {
- set line [sep_clean $line "|"]
- set lineList [split $line "|"]
- set selectorType [lindex $lineList 0]
- case $selectorType in {
- {FileSelector} {
- $this addFileSelector [lindex $lineList 1] \
- [lindex $lineList 2] \
- [lindex $lineList 3]
- }
- {ItemSelector} {
- $this addItemSelector [lindex $lineList 1] \
- [lindex $lineList 2] \
- [lindex $lineList 3]
- }
- }
- }
-
- close $file
- BasicFS::removeFile $tmpFile
- }
-
- method GDRFile::write {this} {
- set tmpFile [BasicFS::tmpFile]
- set file [open $tmpFile w]
- puts $file "#---------------------------------------------------------------------------"
- puts $file "# (c) Cayenne Software Inc. 1997"
- puts $file "# Description: [$this description]"
- puts $file "#---------------------------------------------------------------------------\n"
-
- [$this itemSelectorSet] foreach itemSelector {
- puts $file "ItemSelector | [$itemSelector fileType] | [$itemSelector itemType] | [$itemSelector qualified]"
- }
- [$this fileSelectorSet] foreach fileSelector {
- puts $file "FileSelector | [$fileSelector itemType] | [$fileSelector decompFlags] | [$fileSelector fileTypes]"
- }
-
- close $file
- [$this customFileVersion] upLoad $tmpFile
- BasicFS::removeFile $tmpFile
-
- # set description for repository customization files
- if [[$this customFileVersion] isA RepositoryObject] {
- [$this customFileVersion] setProperty freeText [$this description]
- }
- }
-
- method GDRFile::edit {this} {
- if [[$this customFileVersion] isA RepositoryObject] {
- [$this customFileVersion] edit
- }
- }
-
- method GDRFile::quit {this} {
- if [[$this customFileVersion] isA RepositoryObject] {
- [$this customFileVersion] quit
- }
- }
-
- method GDRFile::addItemSelector {this fileType itemType qualified} {
- GDRItemSelector new $fileType $itemType $qualified $this
- }
-
- method GDRFile::addFileSelector {this itemType decompFlags fileTypes} {
- # strip 'decomp' from the flags
- regsub -all decomp $decompFlags "" decompFlags
-
- GDRFileSelector new $itemType $decompFlags $fileTypes $this
- }
-
-
- method GDRFile::fileSelectors {this} {
- return [[$this fileSelectorSet] contents]
- }
-
- method GDRFile::findItemSelectors {this fileType} {
- set itemSelectors {}
- [$this itemSelectorSet] foreach itemSelector {
- if { [$itemSelector fileType] == $fileType } {
- lappend itemSelectors [list \
- [$itemSelector fileType] [$itemSelector itemType] \
- [$itemSelector qualified]]
- }
- }
-
- return $itemSelectors
- }
-
- method GDRFile::findItemSelector {this fileType itemType} {
- [$this itemSelectorSet] foreach itemSelector {
- if { ([$itemSelector fileType] == $fileType) && \
- ([$itemSelector itemType] == $itemType) } {
- return $itemSelector
- }
- }
-
- return [ORB::nil]
- }
-
- # Do not delete this line -- regeneration end marker
-
- method GDRFile::itemSelectorSet {this} {
- return [$this _itemSelectorSet]
- }
-
- method GDRFile::fileSelectorSet {this} {
- return [$this _fileSelectorSet]
- }
-
-