net.sf.asterisk.manager
Class ManagerConnectionFactory

java.lang.Object
  extended by net.sf.asterisk.manager.ManagerConnectionFactory

public class ManagerConnectionFactory
extends java.lang.Object

This factory is used to obtain new ManagerConnections.

Version:
$Id: ManagerConnectionFactory.java,v 1.3 2005/08/05 05:03:14 srt Exp $
Author:
srt
See Also:
ManagerConnection

Constructor Summary
ManagerConnectionFactory()
          Creates a new ManagerConnectionFactory.
 
Method Summary
 ManagerConnection getManagerConnection()
          Returns a new ManagerConnection with the default values for hostname, port, username and password.
 ManagerConnection getManagerConnection(java.lang.String hostname, int port, java.lang.String username, java.lang.String password)
          Returns a new ManagerConnection to an Asterisk server running on given host with the call manager interface listening on the given port.
 ManagerConnection getManagerConnection(java.lang.String username, java.lang.String password)
          Returns a new ManagerConnection to an Asterisk server running on default host ("localhost" if you didn't change that via setHostname(String)) with the call manager interface listening on the default port (5038 if you didn't change that via setPort(int)).
 ManagerConnection getManagerConnection(java.lang.String hostname, java.lang.String username, java.lang.String password)
          Returns a new ManagerConnection to an Asterisk server running on given host with the call manager interface listening on the default port (5038 if you didn't change that via setPort(int)).
 void setHostname(java.lang.String hostname)
          Sets the default hostname.
Default is "localhost".
 void setPassword(java.lang.String password)
          Sets the default password.
Default is "admin".
 void setPort(int port)
          Sets the default port.
Default is 5038.
 void setUsername(java.lang.String username)
          Sets the default username.
Default is "admin".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagerConnectionFactory

public ManagerConnectionFactory()
Creates a new ManagerConnectionFactory.

Method Detail

setHostname

public void setHostname(java.lang.String hostname)
Sets the default hostname.
Default is "localhost".

Parameters:
hostname - the default hostname
Since:
0.2

setPort

public void setPort(int port)
Sets the default port.
Default is 5038.

Parameters:
port - the default port
Since:
0.2

setUsername

public void setUsername(java.lang.String username)
Sets the default username.
Default is "admin".

Parameters:
username - the default username
Since:
0.2

setPassword

public void setPassword(java.lang.String password)
Sets the default password.
Default is "admin".

Parameters:
username - the default password
Since:
0.2

getManagerConnection

public ManagerConnection getManagerConnection()
                                       throws java.io.IOException
Returns a new ManagerConnection with the default values for hostname, port, username and password. It uses either the built-in defaults ("localhost", 5038, "admin", "admin") or the custom default values you set via setHostname(String), setPort(int), setUsername(String) and setPassword(String).

Returns:
the created connection to the Asterisk call manager
Throws:
java.io.IOException - if the connection cannot be established.
Since:
0.2

getManagerConnection

public ManagerConnection getManagerConnection(java.lang.String username,
                                              java.lang.String password)
                                       throws java.io.IOException
Returns a new ManagerConnection to an Asterisk server running on default host ("localhost" if you didn't change that via setHostname(String)) with the call manager interface listening on the default port (5038 if you didn't change that via setPort(int)).

Parameters:
username - the username as specified in Asterisk's manager.conf
password - the password as specified in Asterisk's manager.conf
Returns:
the created connection to the Asterisk call manager
Throws:
java.io.IOException - if the connection cannot be established.

getManagerConnection

public ManagerConnection getManagerConnection(java.lang.String hostname,
                                              java.lang.String username,
                                              java.lang.String password)
                                       throws java.io.IOException
Returns a new ManagerConnection to an Asterisk server running on given host with the call manager interface listening on the default port (5038 if you didn't change that via setPort(int)).

Parameters:
hostname - the name of the host the Asterisk server is running on
username - the username as specified in Asterisk's manager.conf
password - the password as specified in Asterisk's manager.conf
Returns:
the created connection to the Asterisk call manager
Throws:
java.io.IOException - if the connection cannot be established.

getManagerConnection

public ManagerConnection getManagerConnection(java.lang.String hostname,
                                              int port,
                                              java.lang.String username,
                                              java.lang.String password)
                                       throws java.io.IOException
Returns a new ManagerConnection to an Asterisk server running on given host with the call manager interface listening on the given port.

Parameters:
hostname - the name of the host the Asterisk server is running on
port - the port the call manager interface is listening on
username - the username as specified in Asterisk's manager.conf
password - the password as specified in Asterisk's manager.conf
Returns:
the created connection to the Asterisk call manager
Throws:
java.io.IOException - if the connection cannot be established.


Copyright © 2004-2005 Stefan Reuter. All Rights Reserved.