MCFtpRepository.st
author Claus Gittinger <cg@exept.de>
Sat, 01 Sep 2018 17:32:13 +0200
changeset 1086 efc5221435a5
parent 1051 793db72fde39
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
     1
"{ Encoding: utf8 }"
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
     2
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ Package: 'stx:goodies/monticello' }"
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
     5
"{ NameSpace: Smalltalk }"
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
     6
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
MCFileBasedRepository subclass:#MCFtpRepository
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	instanceVariableNames:'host directory user password connection'
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
	classVariableNames:''
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
	poolDictionaries:''
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    11
	category:'SCM-Monticello-RemoteRepositories'
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    14
!MCFtpRepository class methodsFor:'documentation'!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    15
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    16
documentation
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    17
"
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    18
    I am an monticello repository implementation for the FTP protocol.
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    19
"
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    20
! !
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
904
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    22
!MCFtpRepository class methodsFor:'instance creation'!
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    23
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    24
basicFromUrl: aZnUrl
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    25
	^ self
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    26
		host: (aZnUrl hasPort ifTrue: [ aZnUrl host, ':', aZnUrl port asString ] ifFalse: [ aZnUrl host ])
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    27
		directory: aZnUrl path "MCFtpRepository assumes NO prefixed / in the path"
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    28
		user: (aZnUrl username ifNil: [ '' ])
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    29
		password: (aZnUrl password ifNil: [ '' ])
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    30
!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    31
904
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    32
host: host directory: directory user: user password: password
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    33
	^ self new
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    34
		host: host;
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    35
		directory: directory;
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    36
		user: user;
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    37
		password: password
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    38
! !
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    39
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    40
!MCFtpRepository class methodsFor:'*MonticelloGUI'!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    41
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    42
fillInTheBlankRequest
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    43
	^ 'FTP Repository:'
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    44
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    45
	
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    46
!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    47
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    48
morphicConfigure
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    49
	^ self fillInTheBlankConfigure
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    50
! !
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    51
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    52
!MCFtpRepository class methodsFor:'accessing'!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    53
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    54
urlSchemes
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    55
	^ #(ftp)
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    56
! !
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    57
904
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    58
!MCFtpRepository class methodsFor:'queries'!
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
creationTemplate
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
	^
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
'MCFtpRepository
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
	host: ''modules.squeakfoundation.org''
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
	directory: ''mc''
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
	user: ''squeak''
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
	password: ''squeak'''
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
	
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
description
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
	^ 'FTP'
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
904
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    74
templateCreationSelector
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    75
	^ #host:directory:user:password: 
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    76
! !
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
    77
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    78
!MCFtpRepository methodsFor:'*Komitter-Models'!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    79
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    80
isRemote
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    81
	^ true
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    82
!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    83
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    84
koRemote
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    85
	
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    86
	^ KomitFtpRemote new
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    87
		remote: self;
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    88
		yourself
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    89
! !
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    90
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    91
!MCFtpRepository methodsFor:'*metacello-pharocommonplatform'!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    92
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    93
asRepositorySpecFor: aMetacelloMCProject
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    94
	| dir |
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    95
	dir := directory.
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    96
	(directory at: 1) = $/
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    97
		ifFalse: [ dir := '/', dir ].
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    98
	^(aMetacelloMCProject repositorySpec)
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
    99
		description:  'ftp://', host, dir;
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   100
	 	type: 'ftp';
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   101
		username: user;
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   102
		password: password;
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   103
		yourself
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   104
! !
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   105
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   106
!MCFtpRepository methodsFor:'*metacello-testsplatform'!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   107
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   108
directory
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   109
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   110
	^directory
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   111
!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   112
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   113
host
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   114
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   115
	^host
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   116
! !
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   117
904
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   118
!MCFtpRepository methodsFor:'accessing'!
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   119
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   120
directory: dirPath
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   121
	directory := dirPath
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
904
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   124
host: hostname
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   125
	host := hostname
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   126
!
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   127
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   128
password: passwordString
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   129
	password := passwordString
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   130
!
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   131
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   132
user: userString
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   133
	user := userString
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
! !
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
!MCFtpRepository methodsFor:'as yet unclassified'!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
clientDo: aBlock
912
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   139
        | client |
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   140
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   141
        NVTClient loginFailedSignal handle:[:ex |
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   142
            | answer |
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   143
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   144
            answer := Dialog 
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   145
                requestPassword:('FTP-Login failed (',ex description,'\\Try again with password:') withCRs
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   146
                initialAnswer:password.
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   147
            answer isEmptyOrNil ifTrue:[ AbortOperationRequest raise].
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   148
            password := answer.
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   149
            ex restart
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   150
        ] do:[
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   151
            client := FTPClient openOnHostNamed: host.
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   152
            client loginUser: user password: password.
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   153
            directory isEmpty ifFalse: [client changeDirectoryTo: directory].
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   154
        ].
ac114b27e760 class: MCFtpRepository
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   155
        ^ [aBlock value: client] ensure: [client close]
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
parseDirectoryListing: aString
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
	| stream files line tokens |
233
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   160
	stream := aString readStream.
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   161
	files := OrderedCollection new.
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
	[stream atEnd] whileFalse:
233
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   163
		[line := stream nextLine.
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   164
		tokens := line findTokens: ' '.
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
		tokens size > 2 ifTrue: [files add: tokens last]].
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
	^ files
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
! !
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
515
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   169
!MCFtpRepository methodsFor:'displaying'!
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   170
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   171
displayString
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   172
    ^ self description
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   173
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   174
    "Created: / 14-09-2010 / 23:20:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   175
    "Created: / 25-11-2011 / 11:29:31 / cg"
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   176
! !
c89e117f2158 category changes
Claus Gittinger <cg@exept.de>
parents: 354
diff changeset
   177
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   178
!MCFtpRepository methodsFor:'interface'!
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   179
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   180
loadAllFileNames
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   181
	^ self clientDo:
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   182
		[:client |
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   183
		self parseDirectoryListing: client getDirectory]
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   184
! !
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   185
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
!MCFtpRepository methodsFor:'required'!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
allFileNames
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
	^ self clientDo:
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
		[:client |
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
		self parseDirectoryListing: client getDirectory]
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
description
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   195
    user notNil ifTrue:[
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   196
        ^ 'ftp://', user, '@', host, '/', directory
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   197
    ].
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   198
    ^ 'ftp://', host, '/', directory
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   199
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   200
    "Modified: / 26-08-2018 / 12:35:25 / Claus Gittinger"
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
readStreamForFileNamed: aString do: aBlock
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   204
	
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
	^ self clientDo:
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   206
		[:client | | stream |
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
		client binary.
233
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   208
		stream := RWBinaryOrTextStream on: String new.
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
		stream nextPutAll: (client getFileNamed: aString).
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
		aBlock value: stream reset]
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
writeStreamForFileNamed: aString replace: ignoreBoolean do: aBlock
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
	| stream |
233
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   215
	stream := RWBinaryOrTextStream on: String new.
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
	aBlock value: stream.
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
	self clientDo:
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
		[:client |
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
		client binary.
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
		client putFileStreamContents: stream reset as: aString]
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
! !
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
!MCFtpRepository class methodsFor:'documentation'!
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
version
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   226
    ^ '$Header$'
233
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   227
!
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   228
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   229
version_CVS
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   230
    ^ '$Header$'
233
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   231
!
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   232
979de6702a64 added: #version_CVS
Claus Gittinger <cg@exept.de>
parents: 111
diff changeset
   233
version_SVN
1051
793db72fde39 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   234
    ^ '$Id$'
111
7444c3a2d014 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
! !
904
426b53c7ed2b categories
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
   236