Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22613/src/java/net/sf/asterisk/fastagi
Added Files:
AGIWriter.java AGIWriterImpl.java
Log Message:
Added AGIWriter
--- NEW FILE: AGIWriter.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;
/**
* The AGIWriter sends commands to Asterisk.
*
* @author srt
* @version $Id: AGIWriter.java,v 1.1 2005/03/09 23:52:48 srt Exp $
*/
public interface AGIWriter
{
/**
* Sends the given command to the Asterisk server.
*
* @param command the command to send.
* @throws IOException if the command can't be sent.
*/
void sendCommand(AGICommand command) throws IOException;
}
--- NEW FILE: AGIWriterImpl.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.io.SocketConnectionFacade;
/**
* Default implementation of the AGIWriter interface.
*
* @author srt
* @version $Id: AGIWriterImpl.java,v 1.1 2005/03/09 23:52:48 srt Exp $
*/
public class AGIWriterImpl implements AGIWriter
{
private SocketConnectionFacade socket;
public AGIWriterImpl(SocketConnectionFacade socket)
{
this.socket = socket;
}
public void sendCommand(AGICommand command) throws IOException
{
socket.write(command.buildCommand() + "\n");
socket.flush();
}
}
|