NistSipMessageFactoryImplpublic class NistSipMessageFactoryImpl extends Object implements SIPStackMessageFactoryImplements all the support classes that are necessary for the nist-sip
stack on which the jain-sip stack has been based.
This is a mapping class to map from the NIST-SIP abstractions to
the JAIN abstractions. (i.e. It is the glue code that ties
the NIST-SIP event model and the JAIN-SIP event model together.
When a SIP Request or SIP Response is read from the corresponding
messageChannel, the NIST-SIP stack calls the SIPStackMessageFactory
implementation that has been registered with it to process the request.) |
Fields Summary |
---|
private SipStack | sipStackImplCurrent SIP stack context. |
Constructors Summary |
---|
public NistSipMessageFactoryImpl(SipStack sipStackImpl)Contrictor.
this.sipStackImpl = sipStackImpl;
|
Methods Summary |
---|
public SIPServerRequestInterface | newSIPServerRequest(Request sipRequest, MessageChannel messageChannel)Constructs a new SIP Server Request.
if (messageChannel == null || sipRequest == null) {
throw new IllegalArgumentException("Null Arg!");
}
NistSipMessageHandlerImpl retval = new NistSipMessageHandlerImpl();
if (messageChannel instanceof Transaction) {
// If the transaction has already been created
// then set the transaction channel.
retval.transactionChannel = (Transaction)messageChannel;
}
SIPTransactionStack theStack =
(SIPTransactionStack) messageChannel.getSIPStack();
/*
* IMPL_NOTE :
* May not need to initialize listeningPoint like this. Please refer to
* processRequest() method in NistSipMessageHandlerImpl
*/
retval.listeningPoint =
messageChannel.getMessageProcessor().getListeningPoint();
if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
Logging.report(Logging.INFORMATION, LogChannels.LC_JSR180,
"Returning request interface for " +
sipRequest.getFirstLine() + " " + retval +
" messageChannel = " + messageChannel);
}
return retval;
| public SIPServerResponseInterface | newSIPServerResponse(Response sipResponse, MessageChannel messageChannel)Generates a new server response for the stack.
try {
NistSipMessageHandlerImpl retval = new NistSipMessageHandlerImpl();
SIPTransactionStack theStack = (SIPTransactionStack)
messageChannel.getSIPStack();
SipStack sipStackImpl = (SipStack) theStack;
// Tr is null if a transaction is not mapped.
Transaction tr =
(Transaction)
((SIPTransactionStack)theStack).
findTransaction(sipResponse, false);
retval.transactionChannel = tr;
if (Logging.REPORT_LEVEL <= Logging.INFORMATION) {
Logging.report(Logging.INFORMATION, LogChannels.LC_JSR180,
"Found Transaction " + tr + " for " + sipResponse);
Logging.report(Logging.INFORMATION, LogChannels.LC_JSR180,
"MessageProcessor = " +
messageChannel.getMessageProcessor() + "/" +
messageChannel.getMessageProcessor().getListeningPoint());
}
ListeningPoint lp =
messageChannel.getMessageProcessor().getListeningPoint();
retval.listeningPoint = lp;
return retval;
} catch (RuntimeException ex) {
if (Logging.REPORT_LEVEL <= Logging.ERROR) {
Logging.report(Logging.ERROR, LogChannels.LC_JSR180,
"runtime exception caught!");
ex.printStackTrace();
}
return null;
}
|
|