[Pkg] Rio: File-Base-test.10.mcz

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Mon Dec 22 04:00:50 UTC 2008


A new version of File-Base was added to project Rio:
http://www.squeaksource.com/Rio/File-Base-test.10.mcz

==================== Summary ====================

Name: File-Base-test.10
Author: test
Time: 22 December 2008, 4:00:48 am
UUID: cc9d5316-8b3e-4dc5-bb76-edac76f0768d
Ancestors: File-Base-kph.9

All Tests Pass

=============== Diff against File-Base-kph.9 ===============

Item was changed:
  ----- Method: FileFtpExecutive>>basicReader: (in category 'basic') -----
  basicReader: aRio
  	
  	^ self ftpOpenForRead: aRio!

Item was changed:
  ----- Method: FileFtpExecutive>>closeAndDestroy: (in category 'wrap socket') -----
  closeAndDestroy: timeout
  
  	client closeDataSocket.
  	client checkResponse.
  	
  	rw = #write ifTrue: [ client checkResponse ].!

Item was changed:
  ----- Method: FileFtpExecutive>>ftpOpenClient (in category 'ftp client') -----
  ftpOpenClient
  
+ 	| loginSuccessful what newClient  |
- 	| loginSuccessful what client |
  	 
+ 	newClient := self FTPClient openOnHostNamed: self host.
- 	client := self FTPClient openOnHostNamed: self host.
  	loginSuccessful := false.
  	[loginSuccessful]
  		whileFalse: [
  			[loginSuccessful := true.
+ 			newClient loginUser: self user password: self password]
- 			client loginUser: self user password: self password]
  				on: LoginFailedException
  				do: [:ex | 
  					what := UIManager default 
  						chooseFrom: #('enter password' 'give up') 
  						title: 'Would you like to try another password?'.
  					what = 1 ifFalse: [self error: 'Login failed.'. ^nil]
  							 ifTrue: [ self password: nil ].
  					loginSuccessful := false]].
   	
+ 	home := newClient pwd.
- 	home := client pwd.
  	
+ 	^ newClient!
- 	^client!

Item was changed:
  ----- Method: SharedQueue2>>setItems: (in category '*file-base') -----
  setItems: anOrderedCollection
+ 	items := anOrderedCollection asOrderedCollection!
- 	items := anOrderedCollection!

Item was changed:
  ----- Method: FileFtpExecutive>>toDirLocal:addAllRemote:relativeTo: (in category 'local/remote file copy') -----
  toDirLocal: aDir addAllRemote: someFD relativeTo: aBaseDir
  
+ 	^ self toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir 
- 	self toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir 
  		copySelector: #copyRemoteFile:toLocalFile:!

Item was changed:
  ----- Method: FileFtpExecutive>>copyRemoteFile:toRemoteFile: (in category 'external ftp') -----
  copyRemoteFile: aFile toRemoteFile: bFile
  
  	"we copy the executives to enable multi threaded copying and because we cant read and write with the same executive"
  	
  	^ (aFile executive: aFile executive copy initialize) copyTo: (bFile executive: bFile executive copy initialize)!

Item was changed:
  ----- Method: FileFtpExecutive>>basicWriter: (in category 'basic') -----
  basicWriter: aRio
  
+ 	^ self ftpOpenForWrite: aRio
+ !
- 	^ self ftpOpenForWrite: aRio!

Item was changed:
  ----- Method: FileFtpExecutive>>toDirRemote:addAllLocal:relativeTo: (in category 'local/remote file copy') -----
  toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir
  
+ 	^ self toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir 
- 	self toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir 
  		copySelector: #copyLocalFile:toRemoteFile:!

Item was changed:
  ----- Method: FileFtpExecutive>>toDirRemote:addAllLocal:relativeTo:copySelector: (in category 'local/remote file copy') -----
  toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir copySelector: aSelector
  
  	"here we do two passes, first we ensure that all of the needed directories exist.
  	 for this we use our ususal ftp client.
  	
  	for the file transfers themselves we run n threads feeding from a shared queue
  	
  	"
  
  	| queue map done delay |
  	
  	self ftpDo: [ :ftp |
  	
  		map := self toDir: aDir mkpathAll: someFD relativeTo: aBaseDir.
  
  	].
  
  	delay := Delay forMilliseconds: 100.
  	queue := SharedQueue2 new setItems: map copy.
  	done :=  SharedQueue2 new.
   	
  	self class prefFtpParallel timesRepeat: [
  			[
  				[ queue isEmpty ] whileFalse: [ 
  					queue nextOrNil ifNotNilDo: [ :ea | 
  						[ self perform: aSelector withArguments: ea ] ensure: [ done nextPut: ea ].
  					]
  				]
  			] fork.
  		].
  	
  	[ done size < map size ] whileTrue: [ delay wait ]. 
   
  	^ map collect: [ :ea | ea second ]!

Item was changed:
  ----- Method: FileFtpExecutive>>toDirRemote:addAllRemote:relativeTo: (in category 'local/remote file copy') -----
  toDirRemote: aDir addAllRemote: someFD relativeTo: aBaseDir
  
+ 	^ self toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir 
- 	self toDirRemote: aDir addAllLocal: someFD relativeTo: aBaseDir 
  		 copySelector: #copyRemoteFile:toRemoteFile:!

Item was changed:
  ----- Method: FileFtpExecutive>>ftpOpenForRead: (in category 'ftp client') -----
  ftpOpenForRead: aRio
  
+ 	| str |
  	self ftpClient openPassiveDataConnection.
  	self ftpClient sendCommand: 'RETR ', home , aRio asVmPathName.
  	
  	[client checkResponse]
  		on: TelnetProtocolError
  		do: [:ex |
  			client closeDataSocket.
  			ex pass].
  	
  	"we will wrap a socket for writing"
  	rw := #read.
  	
+ 	 str :=  SocketStream on: self.
+ 	
+ 	aRio isBinary ifTrue: [ str binary ].
+ 	
+ 	^ str!
- 	 ^ SocketStream on: self.!



More information about the Packages mailing list