com.caucho.quercus.lib.bam
Class BamPhpActor

java.lang.Object
  extended by com.caucho.bam.stream.AbstractMessageStream
      extended by com.caucho.bam.actor.SimpleActor
          extended by com.caucho.quercus.lib.bam.BamPhpActor
All Implemented Interfaces:
Actor, ActorHolder, ManagedActor, MessageStream

public class BamPhpActor
extends SimpleActor

BAM actor that calls into a PHP script to handle messages/queries.


Constructor Summary
BamPhpActor()
           
BamPhpActor(Path script, java.lang.String encoding)
           
 
Method Summary
 java.lang.String getEncoding()
           
 Path getScript()
           
 void init()
           
 void message(java.lang.String to, java.lang.String from, java.io.Serializable value)
          Receives a unidirectional message.
 void messageError(java.lang.String to, java.lang.String from, java.io.Serializable value, BamError error)
          Receives a message error.
 void query(long id, java.lang.String to, java.lang.String from, java.io.Serializable value)
          Receives a query call, acting as a service for the query.
 void queryError(long id, java.lang.String to, java.lang.String from, java.io.Serializable value, BamError error)
          Handles a query error from a service Actor.
 void queryResult(long id, java.lang.String to, java.lang.String from, java.io.Serializable value)
          Handles a query response from a service Actor.
 void setEncoding(java.lang.String encoding)
           
 void setScript(Path script)
           
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.bam.actor.SimpleActor
getActor, getAddress, getBroker, getMailbox, getSender, setAddress, setBroker, setMailbox
 
Methods inherited from class com.caucho.bam.stream.AbstractMessageStream
isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.caucho.bam.stream.MessageStream
isClosed
 

Constructor Detail

BamPhpActor

public BamPhpActor()

BamPhpActor

public BamPhpActor(Path script,
                   java.lang.String encoding)
Method Detail

getScript

public Path getScript()

setScript

public void setScript(Path script)

getEncoding

public java.lang.String getEncoding()

setEncoding

public void setEncoding(java.lang.String encoding)

init

@PostConstruct
public void init()
          throws ConfigException
Throws:
ConfigException

message

public void message(java.lang.String to,
                    java.lang.String from,
                    java.io.Serializable value)
Description copied from class: AbstractMessageStream
Receives a unidirectional message. The abstract implementation ignores the message.

Specified by:
message in interface MessageStream
Overrides:
message in class AbstractMessageStream
Parameters:
to - the target actor's address
from - the source actor's address
value - the message payload

messageError

public void messageError(java.lang.String to,
                         java.lang.String from,
                         java.io.Serializable value,
                         BamError error)
Description copied from class: AbstractMessageStream
Receives a message error. The abstract implementation ignores the message.

Specified by:
messageError in interface MessageStream
Overrides:
messageError in class AbstractMessageStream
Parameters:
to - the target actor's address
from - the source actor's address
value - the original message payload
error - the message error

query

public void query(long id,
                  java.lang.String to,
                  java.lang.String from,
                  java.io.Serializable value)
Description copied from class: AbstractMessageStream
Receives a query call, acting as a service for the query. The default implementation returns a feature-not-implemented QueryError message to the client.

Specified by:
query in interface MessageStream
Overrides:
query in class AbstractMessageStream
Parameters:
id - the query identifier used to match requests with responses
to - the service actor's address
from - the client actor's address
value - the query payload

queryResult

public void queryResult(long id,
                        java.lang.String to,
                        java.lang.String from,
                        java.io.Serializable value)
Description copied from class: AbstractMessageStream
Handles a query response from a service Actor. The default implementation ignores the packet.

Specified by:
queryResult in interface MessageStream
Overrides:
queryResult in class AbstractMessageStream
Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
value - the result payload

queryError

public void queryError(long id,
                       java.lang.String to,
                       java.lang.String from,
                       java.io.Serializable value,
                       BamError error)
Description copied from class: AbstractMessageStream
Handles a query error from a service Actor. The default implementation ignores the packet.

Specified by:
queryError in interface MessageStream
Overrides:
queryError in class AbstractMessageStream
Parameters:
id - the query identifier used to match requests with responses
to - the client actor's address
from - the service actor's address
value - the result payload
error - additional error information

toString

public java.lang.String toString()
Overrides:
toString in class AbstractMessageStream