org.apache.qpid.agent
Class Agent

java.lang.Object
  extended by org.apache.qpid.agent.Agent
All Implemented Interfaces:
MessageListener

public class Agent
extends Object
implements MessageListener

The main class for interacting with the QMF bus. Objects which are to be managed can be registered with the agent, as can classes to be exposed via the schema.


Field Summary
protected  long abank
           
protected  int acknowledgeMode
           
protected  long bbank
           
protected  BindingContext bctx
           
protected  ClassLoader classLoader
           
protected  org.apache.qpid.client.AMQConnection connection
           
protected  MessageConsumer cons
           
protected  boolean inside
           
protected  String label
           
protected static org.apache.commons.logging.Log log
           
protected  List managedObjects
           
protected  Map<Long,ManagedObject> objects
           
protected  MessageProducer prod
           
protected  List registeredClasses
           
protected  Queue reply
           
protected  Session session
           
protected  boolean sessionTransacted
           
protected  UUID systemId
           
 
Constructor Summary
Agent()
           
Agent(String label, UUID systemId)
           
 
Method Summary
protected  void attachRequest(String label, UUID systemId)
           
protected  void classIndication(ClassBinding cb)
           
protected  void complete(long seq, Destination dest)
           
protected  void content(char c, long seq, Destination dest, ManagedObject mo)
           
protected  Class getClass(String className)
           
protected  ClassBinding getClassBinding(ManagedObject mobj)
           
 org.apache.qpid.client.AMQConnection getConnection()
           
 String getLabel()
           
 List getManagedObjects()
           
 List getRegisteredClasses()
           
protected  void handleAgentAttach(long seq, Destination replyTo, org.apache.qpid.transport.codec.Decoder dec)
           
protected  void handleGetQuery(long seq, Destination replyTo, org.apache.qpid.transport.codec.Decoder dec)
           
protected  void handleMethodRequest(long seq, Destination replyTo, org.apache.qpid.transport.codec.Decoder dec)
           
protected  void handleSchemaRequest(long seq, Destination replyTo, org.apache.qpid.transport.codec.Decoder dec)
           
protected  org.apache.qpid.transport.codec.BBEncoder init(char opcode)
           
protected  org.apache.qpid.transport.codec.BBEncoder init(char opcode, long sequence)
           
 boolean isSessionTransacted()
           
static void main(String[] args)
           
protected  void methodResponse(long seq, Destination dest, int status, String text)
           
protected  void methodResponse(long seq, Destination dest, int status, String text, MethodBinding method, Object[] result)
           
 void onMessage(Message message)
           
protected  void packageIndication(String pkg)
           
 void raiseEvent(Object value, EventSeverity sev)
          Send an event object to the bus
 void register(ManagedObject managedObject)
           
 void registerClass(Class cls)
           
protected  void schemaResponse(long seq, ClassBinding cb)
           
protected  void send(org.apache.qpid.transport.codec.BBEncoder enc)
           
protected  void send(Destination dest, org.apache.qpid.transport.codec.BBEncoder enc)
           
protected  void send(String routingKey, org.apache.qpid.transport.codec.BBEncoder enc)
           
 void setConnection(org.apache.qpid.client.AMQConnection connection)
           
 void setLabel(String label)
           
 void setManagedObjects(List objectList)
           
 void setRegisteredClasses(List objectList)
           
 void setSessionTransacted(boolean sessionTransacted)
           
 void start()
          Starts up the agent.
 void stop()
          Stops the agents connection to the bus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected org.apache.qpid.client.AMQConnection connection

sessionTransacted

protected boolean sessionTransacted

acknowledgeMode

protected int acknowledgeMode

label

protected String label

systemId

protected UUID systemId

managedObjects

protected List managedObjects

registeredClasses

protected List registeredClasses

session

protected Session session

prod

protected MessageProducer prod

cons

protected MessageConsumer cons

reply

protected Queue reply

bctx

protected BindingContext bctx

objects

protected Map<Long,ManagedObject> objects

bbank

protected long bbank

abank

protected long abank

log

protected static final org.apache.commons.logging.Log log

inside

protected volatile boolean inside

classLoader

protected ClassLoader classLoader
Constructor Detail

Agent

public Agent()

Agent

public Agent(String label,
             UUID systemId)
Method Detail

register

public void register(ManagedObject managedObject)

registerClass

public void registerClass(Class cls)

stop

public void stop()
Stops the agents connection to the bus


start

public void start()
Starts up the agent. Many bean containers may call this by default which aids in deployment


raiseEvent

public void raiseEvent(Object value,
                       EventSeverity sev)
Send an event object to the bus


onMessage

public void onMessage(Message message)
Specified by:
onMessage in interface MessageListener

getClassBinding

protected ClassBinding getClassBinding(ManagedObject mobj)

handleAgentAttach

protected void handleAgentAttach(long seq,
                                 Destination replyTo,
                                 org.apache.qpid.transport.codec.Decoder dec)

handleMethodRequest

protected void handleMethodRequest(long seq,
                                   Destination replyTo,
                                   org.apache.qpid.transport.codec.Decoder dec)

handleGetQuery

protected void handleGetQuery(long seq,
                              Destination replyTo,
                              org.apache.qpid.transport.codec.Decoder dec)

handleSchemaRequest

protected void handleSchemaRequest(long seq,
                                   Destination replyTo,
                                   org.apache.qpid.transport.codec.Decoder dec)

init

protected org.apache.qpid.transport.codec.BBEncoder init(char opcode)

init

protected org.apache.qpid.transport.codec.BBEncoder init(char opcode,
                                                         long sequence)

send

protected void send(org.apache.qpid.transport.codec.BBEncoder enc)

send

protected void send(Destination dest,
                    org.apache.qpid.transport.codec.BBEncoder enc)

send

protected void send(String routingKey,
                    org.apache.qpid.transport.codec.BBEncoder enc)

attachRequest

protected void attachRequest(String label,
                             UUID systemId)

packageIndication

protected void packageIndication(String pkg)

classIndication

protected void classIndication(ClassBinding cb)

schemaResponse

protected void schemaResponse(long seq,
                              ClassBinding cb)

content

protected void content(char c,
                       long seq,
                       Destination dest,
                       ManagedObject mo)

complete

protected void complete(long seq,
                        Destination dest)

methodResponse

protected void methodResponse(long seq,
                              Destination dest,
                              int status,
                              String text)

methodResponse

protected void methodResponse(long seq,
                              Destination dest,
                              int status,
                              String text,
                              MethodBinding method,
                              Object[] result)

getClass

protected Class getClass(String className)

getLabel

public String getLabel()

setLabel

public void setLabel(String label)

getConnection

public org.apache.qpid.client.AMQConnection getConnection()

setConnection

public void setConnection(org.apache.qpid.client.AMQConnection connection)

isSessionTransacted

public boolean isSessionTransacted()

setSessionTransacted

public void setSessionTransacted(boolean sessionTransacted)

setManagedObjects

public void setManagedObjects(List objectList)

getManagedObjects

public List getManagedObjects()

setRegisteredClasses

public void setRegisteredClasses(List objectList)

getRegisteredClasses

public List getRegisteredClasses()

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Licensed to the Apache Software Foundation