# $Id: adapterExample.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $
# include the adapter pattern
source adapter.xotcl

@ @File {
  description {
    Simple adapter pattern example class (FTP requests) taken from the paper 
    'Filters as a Language Support for Design Patterns in
    Object-Oriented Scripting Languages'.
  }
}

Class FTPLIB 
FTPLIB instproc FTPLIB_connect args {
  puts "in ftplib connect"  
}

Class Connection
Connection instproc connect args  {
  puts "in Connection connect"
}
Connection instproc discard args  {
  puts "in Connection discard"
}

Adapter FTP -superclass Connection

FTP instproc init args {
  FTPLIB ftpAdaptee
  my setRequest connect FTPLIB_connect
  my setAdaptee ftpAdaptee
}
FTP f

f connect
f discard
