Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1721/src/java/net/sf/asterisk/fastagi
Added Files:
AGIResponseImpl.java
Log Message:
Added AGIResponseImpl
--- NEW FILE: AGIResponseImpl.java ---
/*
* Copyright 2004-2005 Stefan Reuter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package net.sf.asterisk.fastagi;
import java.io.IOException;
import net.sf.asterisk.fastagi.command.AGICommand;
import net.sf.asterisk.fastagi.reply.AGIReply;
import net.sf.asterisk.io.SocketConnectionFacade;
/**
* Default implementation of the AGIResponse interface.
*
* @author srt
* @version $Id: AGIResponseImpl.java,v 1.1 2005/03/10 07:35:07 srt Exp $
*/
public class AGIResponseImpl implements AGIResponse
{
private AGIWriter agiWriter;
private AGIReader agiReader;
private SocketConnectionFacade socket;
public AGIResponseImpl(SocketConnectionFacade socket)
{
this.socket = socket;
this.agiWriter = new AGIWriterImpl(socket);
this.agiReader = new AGIReaderImpl(socket);
}
public AGIResponseImpl(AGIWriter agiWriter, AGIReader agiReader)
{
this.agiWriter = agiWriter;
this.agiReader = agiReader;
}
public synchronized AGIReply sendCommand(AGICommand command) throws IOException
{
AGIReply reply;
agiWriter.sendCommand(command);
reply = agiReader.readReply();
return reply;
}
}
|