# $Id: WebAgent.xotcl,v 1.3 2005/09/09 21:09:01 neumann Exp $

package provide xotcl::actiweb::webAgent 1.0

package require -exact xotcl::actiweb::agent 1.0
package require -exact xotcl::actiweb::invoker 1.0
package require -exact xotcl::mixinStrategy 1.0

package require XOTcl 1

namespace eval ::xotcl::actiweb::webAgent {
    namespace import ::xotcl::*

    #
    # Web Agent are special agents that allow us to define another
    # object in the paramter webfacade as a facade for the web agent
    # itself and the sub-system shielded by the web agent with an interface
    # for agents
    #
    Class WebAgent -superclass Agent

    WebAgent instproc init args {
	next
    }

    #
    # let the web agents facade handle the call -> interprete args
    # as "method args"
    # return result of the invoker
    #
    #WebAgent instproc invokeFacade {args} {
    #  set a ""
    #  set m ""
    #  set l [llength $args]
    #  set o [my webfacade]
    #  if {$l > 0} {
    #    set m [lindex $args 0]
    #  }
    #  if {$l > 1} {
    #    set a [lrange $args 1 end]
    #  } 
    #    
    #  #puts stderr "Web Agent [self]->invoke:  OBJ: $o PROC: $m ARGS: $a"
    #
    #  #
    #  # tell the invoker to redirect the call to the webfacade object
    #  #
    #  set re [RedirectException [self]::[my autoname re] \
    #	    -obj $o -method $m -arguments $a]
    #
    #  return $re
    #}

    #WebAgent instproc default args {
    #  return [next]
    #}

    namespace export WebAgent
}

namespace import ::xotcl::actiweb::webAgent::*
