SystemOrganization addCategory: #'FTP-Server'! SystemOrganization addCategory: #'FTP-Context'! Notification subclass: #FTPCurrentSession instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'FTP-Server'! !FTPCurrentSession class methodsFor: 'as yet unclassified' stamp: 'lr 8/16/2005 09:48'! use: aSession during: aBlock ^ aBlock on: self do: [ :n | n resume: aSession ].! ! !FTPCurrentSession class methodsFor: 'as yet unclassified' stamp: 'lr 8/16/2005 09:50'! value ^ self signal! ! Object subclass: #FTPConnection instanceVariableNames: 'server socket stream' classVariableNames: '' poolDictionaries: '' category: 'FTP-Server'! !FTPConnection methodsFor: 'initialization' stamp: 'lr 8/16/2005 14:22'! setServer: aServer server := aServer.! ! !FTPConnection methodsFor: 'state' stamp: 'lr 8/16/2005 14:56'! status: anInteger self status: anInteger description: 'OK'.! ! !FTPConnection methodsFor: 'writing' stamp: 'lr 8/16/2005 14:57'! writeLine: aString self isLogging ifTrue: [ Transcript show: '<<'; space; show: aString; cr ]. self stream nextPutAll: aString; nextPutAll: String crlf; flush.! ! !FTPConnection methodsFor: 'reading' stamp: 'lr 8/16/2005 14:30'! readLine | line | line := self stream upTo: Character lf. (line notEmpty and: [ line last = Character cr ]) ifTrue: [ line := line allButLast ]. self isLogging ifTrue: [ Transcript show: '>>'; space; show: line; cr ]. ^ line.! ! !FTPConnection methodsFor: 'testing' stamp: 'lr 8/16/2005 14:09'! isLogging ^ true! ! !FTPConnection methodsFor: 'actions' stamp: 'lr 8/16/2005 14:24'! close self stream close. self socket destroy.! ! !FTPConnection methodsFor: 'state' stamp: 'lr 8/16/2005 14:54'! statusReady self status: 220 description: 'SqueakFtp ready'.! ! !FTPConnection methodsFor: 'accessing' stamp: 'lr 8/16/2005 13:54'! stream ^ stream! ! !FTPConnection methodsFor: 'initialization' stamp: 'lr 8/16/2005 14:23'! setSocket: aSocket socket := aSocket. stream := SocketStream on: aSocket.! ! !FTPConnection methodsFor: 'state' stamp: 'lr 8/16/2005 14:53'! status: anInteger description: aString self writeLine: (String streamContents: [ :s | s print: anInteger; space; nextPutAll: aString ]).! ! !FTPConnection methodsFor: 'accessing' stamp: 'lr 8/16/2005 13:54'! socket ^ socket! ! !FTPConnection methodsFor: 'testing' stamp: 'lr 8/16/2005 14:36'! isConnected ^ self socket isValid and: [ self socket isConnected ].! ! !FTPConnection methodsFor: 'accessing' stamp: 'lr 8/16/2005 13:53'! server ^ server! ! !FTPConnection methodsFor: 'writing' stamp: 'lr 8/16/2005 14:14'! writeLines: aCollection aCollection do: [ :each | self writeLine: each ].! ! Object subclass: #FTPServer instanceVariableNames: 'process port priority context listener' classVariableNames: 'Servers' poolDictionaries: '' category: 'FTP-Server'! !FTPServer commentStamp: 'ijp 1/14/2005 19:09' prior: 0! An FTP Server.! !FTPServer methodsFor: 'accessing-readonly' stamp: 'lr 11/21/2004 22:11'! listener ^listener! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/21/2004 23:16'! destroyListener listener destroy. listener := nil.! ! !FTPServer class methodsFor: 'accessing' stamp: 'lr 11/21/2004 23:14'! responseCodes ^#(200 'Command okay.' 500 'Syntax error, command unrecognized. This may include errors such as command line too long.' 501 'Syntax error in parameters or arguments.' 202 'Command not implemented, superfluous at this site.' 502 'Command not implemented.' 503 'Bad sequence of commands.' 504 'Command not implemented for that parameter.' 110 'Restart marker reply. In this case, the text is exact and not left to the particular implementation; it must read: MARK yyyy = mmmm Where yyyy is User-process data stream marker, and mmmm server''s equivalent marker (note the spaces between markers and "=").' 211 'System status, or system help reply.' 212 'Directory status.' 213 'File status.' 214 'Help message. On how to use the server or the meaning of a particular non-standard command. This reply is useful only to the human user.' 215 'NAME system type. Where NAME is an official system name from the list in the Assigned Numbers document.' 120 'Service ready in nnn minutes.' 220 'Service ready for new user.' 221 'Service closing control connection. Logged out if appropriate.' 421 'Service not available, closing control connection. This may be a reply to any command if the service knows it must shut down.' 125 'Data connection already open; transfer starting.' 225 'Data connection open; no transfer in progress.' 425 'Can''t open data connection.' 226 'Closing data connection. Requested file action successful (for example, file transfer or file abort).' 426 'Connection closed; transfer aborted.' 227 'Entering Passive Mode (h1,h2,h3,h4,p1,p2).' 230 'User logged in, proceed.' 530 'Not logged in.' 331 'User name okay, need password.' 332 'Need account for login.' 532 'Need account for storing files.' 150 'File status okay; about to open data connection.' 250 'Requested file action okay, completed.' 257 '"PATHNAME" created.' 350 'Requested file action pending further information.' 450 'Requested file action not taken. File unavailable (e.g., file busy).' 550 'Requested action not taken. File unavailable (e.g., file not found, no access).' 451 'Requested action aborted. Local error in processing.' 551 'Requested action aborted. Page type unknown.' 452 'Requested action not taken. Insufficient storage space in system.' 552 'Requested file action aborted. Exceeded storage allocation (for current directory or dataset).' 553 'Requested action not taken. File name not allowed.') ! ! !FTPServer class methodsFor: 'private-callbacks' stamp: 'lr 11/21/2004 21:35'! startUp self servers do: [ :each | each restart ].! ! !FTPServer class methodsFor: 'private' stamp: 'lr 11/21/2004 21:35'! addServer: aServer self servers add: aServer.! ! !FTPServer methodsFor: 'accessing' stamp: 'lr 11/21/2004 20:29'! context context isNil ifTrue: [ context := self defaultContext ]. ^context! ! !FTPServer methodsFor: 'accessing-configuration' stamp: 'lr 11/21/2004 20:45'! defaultPort ^21.! ! !FTPServer methodsFor: 'accessing-configuration' stamp: 'lr 11/21/2004 20:46'! defaultBacklog ^10.! ! !FTPServer methodsFor: 'accessing' stamp: 'lr 11/21/2004 19:43'! priority: aNumber priority := aNumber. self isRunning ifTrue: [ process priority: aNumber ].! ! !FTPServer class methodsFor: 'private' stamp: 'lr 11/21/2004 20:06'! servers Servers isNil ifTrue: [ Servers := Set new ]. ^Servers! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/21/2004 20:53'! destroyProcess process := nil.! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/21/2004 23:56'! createProcess process := Process forContext: [ [ self serverLoop ] ensure: [ self destroyServer ] ] priority: self priority.! ! !FTPServer class methodsFor: 'instance creation' stamp: 'lr 11/21/2004 21:19'! start ^self new start; yourself.! ! !FTPServer methodsFor: 'testing' stamp: 'lr 8/16/2005 14:44'! isRunning ^ self process notNil.! ! !FTPServer methodsFor: 'accessing-configuration' stamp: 'lr 11/21/2004 20:31'! defaultContext ^FTPFilesystemContext on: (FileDirectory default).! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/21/2004 21:08'! createServer self createProcess. self createListener.! ! !FTPServer methodsFor: 'accessing-readonly' stamp: 'lr 11/21/2004 20:56'! process ^process! ! !FTPServer methodsFor: 'testing' stamp: 'lr 8/16/2005 14:44'! isConnected ^ self listener notNil and: [ self listener isValid ] and: [ self listener isWaitingForConnection ].! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/21/2004 23:16'! createListener listener := Socket newTCP. listener listenOn: self port backlogSize: self defaultBacklog.! ! !FTPServer class methodsFor: 'private' stamp: 'lr 11/21/2004 19:56'! removeServer: aServer self servers remove: aServer.! ! !FTPServer methodsFor: 'accessing' stamp: 'lr 11/21/2004 19:44'! port: aNumber port := aNumber. self isRunning ifTrue: [ self restart ].! ! !FTPServer methodsFor: 'accessing-configuration' stamp: 'lr 11/22/2004 00:09'! defaultSessionTimeout ^320.! ! !FTPServer class methodsFor: 'instance creation' stamp: 'lr 11/21/2004 20:28'! start: aContext ^self new context: aContext; start; yourself.! ! !FTPServer methodsFor: 'actions' stamp: 'lr 11/21/2004 19:45'! restart self stop; start.! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/21/2004 21:08'! destroyServer self destroyProcess. self destroyListener.! ! !FTPServer class methodsFor: 'instance creation' stamp: 'lr 11/21/2004 21:36'! start: aContext port: anInteger ^self new context: aContext; port: anInteger; start; yourself.! ! !FTPServer methodsFor: 'accessing-configuration' stamp: 'lr 11/21/2004 19:47'! defaultPriority ^Processor userBackgroundPriority.! ! !FTPServer methodsFor: 'accessing' stamp: 'lr 11/21/2004 20:29'! context: aContext context := aContext.! ! !FTPServer methodsFor: 'actions' stamp: 'lr 11/21/2004 20:56'! stop self isRunning ifFalse: [ ^self ]. self process terminate. self class removeServer: self.! ! !FTPServer methodsFor: 'accessing-configuration' stamp: 'lr 11/21/2004 20:46'! defaultAcceptTimeout ^10.! ! !FTPServer methodsFor: 'actions' stamp: 'lr 11/21/2004 20:56'! start self isRunning ifTrue: [ ^self ]. self createServer. self process resume. self class addServer: self.! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/22/2004 10:19'! serverLoopBody | socket | self isConnected ifFalse: [ self destroyListener; createListener ]. socket := listener waitForAcceptFor: self defaultAcceptTimeout ifTimedOut: [ nil ]. socket notNil ifTrue: [ socket isConnected ifTrue: [ self createSession: socket ] ifFalse: [ socket destroy ] ]. ! ! !FTPServer methodsFor: 'accessing' stamp: 'lr 11/21/2004 19:51'! port port isNil ifTrue: [ port := self defaultPort ]. ^port! ! !FTPServer methodsFor: 'accessing' stamp: 'lr 11/21/2004 19:52'! priority priority isNil ifTrue: [ priority := self defaultPriority ]. ^priority! ! !FTPServer class methodsFor: 'class initialization' stamp: 'lr 11/21/2004 21:35'! initialize Smalltalk addToStartUpList: self.! ! !FTPServer methodsFor: 'private' stamp: 'lr 11/21/2004 20:55'! serverLoop [ self serverLoopBody ] repeat.! ! !FTPServer methodsFor: 'printing' stamp: 'lr 11/21/2004 21:38'! printOn: aStream super printOn: aStream. aStream space; nextPutAll: 'port: '; print: self port. aStream space; nextPutAll: 'context: '; print: self context.! ! !FTPServer methodsFor: 'private' stamp: 'lr 8/16/2005 15:19'! createSession: aSocket FTPSession new setContext: self context copy; setTelnet: (FTPConnection new setServer: self; setSocket: aSocket); start.! ! Object subclass: #FTPSession instanceVariableNames: 'process context telnet data' classVariableNames: '' poolDictionaries: '' category: 'FTP-Server'! !FTPSession methodsFor: 'accessing-reading' stamp: 'lr 8/16/2005 15:15'! telnet ^ telnet! ! !FTPSession methodsFor: 'private-handlers' stamp: 'lr 8/16/2005 10:17'! withSessionHandlerDo: aBlock FTPCurrentSession use: self during: aBlock.! ! !FTPSession methodsFor: 'commands-file-actions' stamp: 'lr 11/22/2004 00:12'! stor: aString self halt.! ! !FTPSession methodsFor: 'commands-file-actions' stamp: 'lr 8/16/2005 15:17'! rest: aString self telnet status: 502.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:15'! appe: aString self telnet status: 502.! ! !FTPSession methodsFor: 'commands-parameters' stamp: 'lr 11/21/2004 23:43'! mode: aString self halt.! ! !FTPSession methodsFor: 'commands-logout' stamp: 'lr 8/16/2005 15:17'! rein: aString "This command terminates a USER, flushing all I/O and account information, except to allow any transfer in progress to be completed. All parameters are reset to the default settings and the control connection is left open. This is identical to the state in which a user finds himself immediately after the control connection is opened. A USER command may be expected to follow." self context username: nil; password: nil. self telnet status: 502.! ! !FTPSession methodsFor: 'commands-informational' stamp: 'lr 8/16/2005 15:16'! help: aString self telnet writeLine: self context help.! ! !FTPSession methodsFor: 'accessing' stamp: 'lr 8/15/2005 18:25'! context ^ context! ! !FTPSession methodsFor: 'actions' stamp: 'lr 8/16/2005 15:18'! stop self isRunning ifFalse: [ ^ self ]. self process terminate. self telnet close. self data close.! ! !FTPSession methodsFor: 'private-server' stamp: 'lr 8/16/2005 15:16'! destroyServer self telnet close. self data notNil ifTrue: [ self data close ]. self process terminate. process := telnet := data := nil.! ! !FTPSession methodsFor: 'commands-parameters' stamp: 'lr 8/16/2005 15:16'! pasv: aString self telnet status: 502.! ! !FTPSession methodsFor: 'private-server' stamp: 'lr 8/16/2005 15:17'! sessionLoop self withErrorHandlerDo: [ self withSessionHandlerDo: [ [ self isConnected ] whileTrue: [ self execute: self telnet readLine ] ] ].! ! !FTPSession methodsFor: 'accessing' stamp: 'lr 8/16/2005 10:19'! context: aContext context := aContext! ! !FTPSession methodsFor: 'accessing-reading' stamp: 'lr 8/16/2005 15:14'! data ^ data! ! !FTPSession methodsFor: 'commands-file-actions' stamp: 'lr 8/16/2005 15:18'! stou: aString self telnet status: 502.! ! !FTPSession methodsFor: 'initialization' stamp: 'lr 8/16/2005 15:19'! setTelnet: aConnection telnet := aConnection! ! !FTPSession methodsFor: 'commands-informational' stamp: 'lr 8/16/2005 15:18'! syst: aString self telnet writeLine: self context system.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 14:40'! nlst: aString self list: aString.! ! !FTPSession methodsFor: 'commands-login' stamp: 'lr 8/16/2005 15:15'! cdup: aString "This command is a special case of CWD, and is included to simplify the implementation of programs for transferring directory trees between operating systems having different syntaxes for naming the parent directory. The reply codes shall be identical to the reply codes of CWD." self context: (self context changeDirectoryToParent). self telnet status: 250.! ! !FTPSession methodsFor: 'commands-file-actions' stamp: 'lr 8/16/2005 15:15'! allo: aString self telnet status: 502.! ! !FTPSession methodsFor: 'testing' stamp: 'lr 8/16/2005 14:07'! isRunning ^ self process notNil.! ! !FTPSession methodsFor: 'private-handlers' stamp: 'lr 8/16/2005 15:18'! withErrorHandlerDo: aBlock aBlock on: Error do: [ :ex | self telnet status: 500 description: ex messageText ].! ! !FTPSession methodsFor: 'commands-logout' stamp: 'lr 11/21/2004 23:45'! quit: aString "This command terminates a USER and if file transfer is not in progress, the server closes the control connection. If file transfer is in progress, the connection will remain open for result response and the server will then close it. If the user-process is transferring files for several USERs but does not wish to close and then reopen connections for each, then the REIN command should be used instead of QUIT. An unexpected close on the control connection will cause the server to take the effective action of an abort (ABOR) and a logout (QUIT)." self stop.! ! !FTPSession methodsFor: 'commands-login' stamp: 'lr 8/16/2005 15:17'! smnt: aString "This command allows the user to mount a different file system data structure without altering his login or accounting information. Transfer parameters are similarly unchanged. The argument is a pathname specifying a directory or other system dependent file group designator." self telnet status: 502.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:15'! abor: aString self telnet status: 502.! ! !FTPSession methodsFor: 'private-server' stamp: 'lr 8/16/2005 15:15'! createServer process := Process forContext: [ [ self sessionLoop ] ensure: [ self destroyServer ] ] priority: self telnet server priority.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:17'! rnto: aString self telnet status: 502.! ! !FTPSession methodsFor: 'commands-parameters' stamp: 'lr 11/21/2004 23:43'! stru: aString self halt.! ! !FTPSession methodsFor: 'commands-file-actions' stamp: 'lr 11/22/2004 00:12'! retr: aString self halt.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:15'! dele: aString self telnet status: 502.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:16'! list: aString self context listDirectory. self telnet status: 226.! ! !FTPSession methodsFor: 'testing' stamp: 'lr 8/16/2005 10:53'! isValidCommand: aSelector | category | category := self class whichCategoryIncludesSelector: aSelector. ^ category notNil and: [ category beginsWith: 'commands' ].! ! !FTPSession methodsFor: 'commands-login' stamp: 'lr 8/16/2005 15:15'! cwd: aString "This command allows the user to work with a different directory or dataset for file storage or retrieval without altering his login or accounting information. Transfer parameters are similarly unchanged. The argument is a pathname specifying a directory or other system dependent file group designator." self context: (self context changeDirectoryTo: aString). self telnet status: 250.! ! !FTPSession methodsFor: 'initialization' stamp: 'lr 8/16/2005 14:56'! setContext: aContext context := aContext! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:16'! pwd: aString self telnet status: 257 description: '"' , self context workingDirectory , '"'.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:17'! rmd: aString self telnet status: 502.! ! !FTPSession methodsFor: 'actions' stamp: 'lr 8/16/2005 15:17'! start self isRunning ifTrue: [ ^ self ]. self createServer. self telnet statusReady. self process resume.! ! !FTPSession methodsFor: 'private-server' stamp: 'lr 8/16/2005 15:16'! execute: aString | command selector argument | aString isEmptyOrNil ifFalse: [ command := aString copyUpTo: $ . command notEmpty ifTrue: [ selector := (command asLowercase copyWith: $:) asSymbol. (self isValidCommand: selector) ifTrue: [ argument := aString copyAfter: $ . ^ self perform: selector with: argument ] ] ]. self telnet status: 502 description: 'Command not implemented'.! ! !FTPSession methodsFor: 'commands-miscellaneous' stamp: 'lr 8/16/2005 15:17'! site: aString self telnet status: 502.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:16'! mkd: aString self telnet status: 502.! ! !FTPSession methodsFor: 'commands-login' stamp: 'lr 8/16/2005 15:18'! user: aString "The argument field is a Telnet string identifying the user. The user identification is that which is required by the server for access to its file system. This command will normally be the first command transmitted by the user after the control connections are made (some servers may require this). Additional identification information in the form of a password and/or an account command may also be required by some servers. Servers may allow a new USER command to be entered at any point in order to change the access control and/or accounting information. This has the effect of flushing any user, password, and account information already supplied and beginning the login sequence again. All transfer parameters are unchanged and any file transfer in progress is completed under the old access control parameters." self context username: aString. self telnet status: 200.! ! !FTPSession methodsFor: 'commands-login' stamp: 'lr 8/16/2005 15:15'! acct: aString "The argument field is a Telnet string identifying the user's account. The command is not necessarily related to the USER command, as some sites may require an account for login and others only for specific access, such as storing files. In the latter case the command may arrive at any time. There are reply codes to differentiate these cases for the automation: when account information is required for login, the response to a successful PASSword command is reply code 332. On the other hand, if account information is NOT required for login, the reply to a successful PASSword command is 230; and if the account information is needed for a command issued later in the dialogue, the server should return a 332 or 532 reply depending on whether it stores (pending receipt of the ACCounT command) or discards the command, respectively." self telnet status: 502. ! ! !FTPSession methodsFor: 'commands-parameters' stamp: 'lr 8/16/2005 10:41'! type: aString self halt.! ! !FTPSession methodsFor: 'commands-file-transfer' stamp: 'lr 8/16/2005 15:17'! rnfr: aString self telnet status: 502.! ! !FTPSession methodsFor: 'commands-informational' stamp: 'lr 8/16/2005 15:17'! stat: aString self telnet writeLine: self context statistics.! ! !FTPSession methodsFor: 'accessing-reading' stamp: 'lr 8/16/2005 10:24'! process ^ process! ! !FTPSession methodsFor: 'commands-login' stamp: 'lr 8/16/2005 15:16'! pass: aString "The argument field is a Telnet string specifying the user's password. This command must be immediately preceded by the user name command, and, for some sites, completes the user's identification for access control. Since password information is quite sensitive, it is desirable in general to 'mask' it or suppress typeout. It appears that the server has no foolproof way to achieve this. It is therefore the responsibility of the user-FTP process to hide the sensitive password information." self context password: aString. self telnet status: 200.! ! !FTPSession methodsFor: 'commands-parameters' stamp: 'lr 8/16/2005 15:40'! port: aString | numbers socket ip port | numbers := (aString findTokens: $,) collect: [ :each | each asNumber ]. ip := ByteArray with: numbers first with: numbers second with: numbers third with: numbers fourth. port := numbers fifth * 256 + numbers sixth. self halt. socket := Socket newTCP. socket connectTo: ip port: port. data := FTPConnection new setServer: self telnet server; setSocket: socket; yourself. self telnet status: 200.! ! !FTPSession methodsFor: 'testing' stamp: 'lr 8/16/2005 15:16'! isConnected ^ self telnet notNil and: [ self telnet isConnected ].! ! !FTPSession methodsFor: 'commands-miscellaneous' stamp: 'lr 8/16/2005 15:16'! noop: aString "This command does not affect any parameters or previously entered commands. It specifies no action other than that the server send an OK reply." self telnet status: 200.! ! Object subclass: #FTPContext instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'FTP-Server'! !FTPContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 09:56'! changeDirectoryToParent self subclassResponsibility.! ! !FTPContext methodsFor: 'actions' stamp: 'lr 11/21/2004 19:26'! password: aString! ! !FTPContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 09:55'! workingDirectory self subclassResponsibility.! ! !FTPContext methodsFor: 'accessing-information' stamp: 'lr 8/16/2005 09:54'! help ^ self class comment.! ! FTPContext subclass: #FTPAuthenticatedContext instanceVariableNames: 'username password' classVariableNames: '' poolDictionaries: '' category: 'FTP-Context'! !FTPAuthenticatedContext methodsFor: 'accessing' stamp: 'lr 8/16/2005 10:41'! password ^ password! ! !FTPAuthenticatedContext methodsFor: 'accessing' stamp: 'lr 11/21/2004 19:15'! username: aString username := aString! ! FTPAuthenticatedContext subclass: #FTPClassContext instanceVariableNames: 'actualClass actuaClass' classVariableNames: '' poolDictionaries: '' category: 'FTP-Context'! !FTPClassContext methodsFor: 'navigation' stamp: 'ijp 8/15/2005 17:26'! workingDirectory ^ String streamContents: [ :stream | stream nextPut: $/. self actualClass withAllSuperclasses allButLast reverse do: [ :each | stream nextPutAll: each asString ] separatedBy: [ stream nextPut: $/ ] ].! ! !FTPClassContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 09:57'! changeDirectoryToParent ^ self species new actualClass: self actualClass superclass; yourself.! ! !FTPClassContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 15:39'! listDirectory self actualClass subclasses do: [ :each | self session data writeLine: each name ]. self actualClass selectors do: [ :each | self session data writeLine: each ].! ! !FTPClassContext methodsFor: 'accessing' stamp: 'ijp 8/15/2005 17:14'! actualClass: aClass actualClass := aClass! ! !FTPClassContext methodsFor: 'accessing' stamp: 'ijp 8/15/2005 17:00'! actualClass ^ actualClass ifNil: [ actuaClass := ProtoObject ]! ! !FTPClassContext methodsFor: 'accessing-dynamic' stamp: 'lr 8/16/2005 15:08'! subclasses ^ self actualClass subclasses! ! !FTPClassContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 09:57'! changeDirectoryTo: aString ^ self species new actualClass: (Smalltalk at: aString asSymbol); yourself.! ! !FTPAuthenticatedContext methodsFor: 'accessing' stamp: 'lr 8/16/2005 10:41'! username ^ username! ! FTPAuthenticatedContext subclass: #FTPFilesystemContext instanceVariableNames: 'parent directory' classVariableNames: '' poolDictionaries: '' category: 'FTP-Context'! !FTPFilesystemContext methodsFor: 'accessing' stamp: 'lr 8/16/2005 11:04'! directory: aDirectory directory := aDirectory! ! !FTPFilesystemContext methodsFor: 'accessing' stamp: 'lr 8/16/2005 11:19'! directory ^ directory ifNil: [ directory := FileDirectory default ].! ! !FTPFilesystemContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 11:10'! workingDirectory ^ String streamContents: [ :stream | stream nextPut: $/. self withAllParents do: [ :each | stream nextPutAll: each ] separatedBy: [ stream nextPut: $/ ] ].! ! !FTPFilesystemContext methodsFor: 'accessing' stamp: 'lr 8/16/2005 11:05'! parent: aContext parent := aContext! ! !FTPFilesystemContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 11:05'! changeDirectoryToParent ^ self parent isNil ifFalse: [ self parent ] ifTrue: [ self ].! ! !FTPFilesystemContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 11:20'! changeDirectoryTo: aString ^ self copy directory: (self directory on: self directory pathName , self directory pathNameDelimiter asString , aString); parent: self; yourself.! ! !FTPFilesystemContext methodsFor: 'accessing' stamp: 'lr 8/16/2005 11:04'! parent ^ parent! ! !FTPFilesystemContext methodsFor: 'accessing-dynamic' stamp: 'lr 8/16/2005 11:22'! withAllParents ^ self parent isNil ifTrue: [ OrderedCollection new ] ifFalse: [ self parent withAllParents add: self directory pathParts last; yourself ].! ! !FTPAuthenticatedContext methodsFor: 'accessing' stamp: 'lr 11/21/2004 19:15'! password: aString password := aString! ! !FTPContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 09:55'! listDirectory self subclassResponsibility.! ! !FTPContext methodsFor: 'navigation' stamp: 'lr 8/16/2005 09:56'! changeDirectoryTo: aString self subclassResponsibility.! ! !FTPContext methodsFor: 'accessing' stamp: 'lr 8/16/2005 09:51'! session ^ FTPCurrentSession value.! ! !FTPContext methodsFor: 'accessing-information' stamp: 'lr 8/16/2005 09:54'! system ^ SmalltalkImage current vmVersion.! ! !FTPContext methodsFor: 'actions' stamp: 'lr 11/21/2004 19:26'! username: aString! ! !FTPContext methodsFor: 'accessing-information' stamp: 'lr 8/16/2005 09:54'! statistics ^ SmalltalkImage current vmStatisticsReportString.! ! !FTPContext methodsFor: 'private' stamp: 'lr 11/21/2004 19:10'! errorInvalidCommand ^self error: 'Invalid command'! ! FTPServer initialize!