FileDocCategorySizeDatePackage
MessageProcessor.javaAPI DocphoneME MR2 API (J2ME)4837Wed May 02 18:00:42 BST 2007gov.nist.siplite.stack

MessageProcessor

public abstract class MessageProcessor extends Object
This is the Stack abstraction for the active object that waits for messages to appear on the wire and processes these messages by calling the MessageFactory interface to create a ServerRequest or ServerResponse object. The main job of the message processor is to instantiate message channels for the given transport.
version
JAIN-SIP-1.1 This code is in the public domain.

Fields Summary
private ListeningPoint
listeningPoint
Currrent listening point.
boolean
exitFlag
Flag indicating exit in progress.
private int
useCount
Number of message processor users.
Constructors Summary
Methods Summary
synchronized voidclearUseCount()
Clears the count of channels.

        useCount = 0;
    
public abstract MessageChannelcreateMessageChannel(HostPort targetHostPort)
Creates a message channel for the specified host/port.

param
targetHostPort destination for logged message
return
New MessageChannel for this processor.

synchronized voiddecrementUseCount()
Decrements the count of channels.

        if (0 != useCount) {
             useCount --;
        }
    
public ListeningPointgetListeningPoint()
Gets the current listening point.

return
the current listening point

        return listeningPoint;
    
public abstract intgetPort()
Gets the port identifier.

return
the port for this message processor. This is where you receive messages.

public abstract SIPMessageStackgetSIPStack()
Gets the SIP Stack.

return
the sip stack.

public abstract java.lang.StringgetTransport()
Gets the transport string.

return
A string that indicates the transport. (i.e. "tcp" or "udp")

public ViaHeadergetViaHeader()
Get the Via header to assign for this message processor.

return
the via header

        
        ViaHeader via = new ViaHeader();
        Host host = new Host();
        host.setHostname(this.getSIPStack().getHostAddress());
        via.setHost(host);
        via.setPort(this.getPort());
        via.setTransport(this.getTransport());
        return via;
    
public synchronized booleaninUse()
Return true if there are pending messages to be processed (which prevents the message channel from being closed).

return
true if message channel is in use

        return (useCount != 0);
    
synchronized voidincrementUseCount()
Increments the count of channels.

        useCount ++;
    
public abstract booleanisSecure()
Flags whether this processor is secure or not.

return
true if this processor is secure

public voidsetListeningPoint(ListeningPoint lp)
Sets the listening point for message processor.

param
lp the new listening point

        listeningPoint = lp;
    
public abstract voidstart()
Starts our thread.

public abstract voidstop()
Stops the processor thread.

public booleantoExit()
Returns the exitin progres flag.

return
true if exit is in progress

        return exitFlag;