public abstract class Connector extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Connector.Status
Enumeration of the connector status.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Connector()
Because this object should be a singleton the constructor is protected.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectorListener(ConnectorListener listener)
Adds the specified listener to this connector.
|
void |
addConnectorListener(ConnectorListener listener,
boolean checkAttached)
Adds the specified listener to this connector.
|
void |
addConnectorListener(ConnectorListener listener,
boolean checkAttached,
boolean isSynchronous)
Adds the specified listener to this connector.
|
Connector.Status |
connect()
Tries to connect this connector to the Skype client.
|
protected abstract Connector.Status |
connect(int timeout)
Tries to connect this connector to the Skype client on the platform
mechanism.
|
void |
dispose()
Disconnects from the Skype client and clean up the resources.
|
protected abstract void |
disposeImpl()
Disconnects from the Skype client and clean up the resources of the
platfrom.
|
String |
execute(String command)
Executes the specified command and gets the response.
|
void |
execute(String command,
MessageProcessor processor)
Deprecated.
|
String |
execute(String command,
String responseHeader)
Executes the specified command and gets the response.
|
String |
execute(String command,
String[] responseHeaders)
Executes the specified command and gets the response.
|
protected String |
execute(String command,
String[] responseHeaders,
boolean checkAttached)
Executes the specified command and gets the response.
|
String |
executeWithId(String command,
String responseHeader)
Executes the specified command and gets the response using a command ID.
|
String |
executeWithoutTimeout(String command,
String responseHeader)
Executes the specified command and waits for the response without
timeout.
|
protected void |
fireMessageReceived(String message)
Fires a message received event.
|
String |
getApplicationName()
Gets the application name used to get the access grant of Skype API.
|
int |
getCommandTimeout()
Gets the command reply timeout of this connector.
|
int |
getConnectTimeout()
Gets the connect timeout of this connector.
|
PrintWriter |
getDebugOut()
Gets the debug output stream.
|
String |
getInstalledPath()
Try to get the absolute path to the skype client.
|
static Connector |
getInstance()
Initializes a platform specific connection.
|
Connector.Status |
getStatus()
Gets the status of this connector.
|
String |
getStringProperty(String name)
Gets the specified property value.
|
protected void |
initialize()
Initializes this connector.
|
protected abstract void |
initializeImpl()
Initializes the platform specific resources.
|
boolean |
isRunning()
Checks if the Skype client is running or not.
|
void |
removeConnectorListener(ConnectorListener listener)
Removes the specified listener from this connector.
|
protected void |
sendApplicationName(String applicationName)
Sends the application name to the Skype client.
|
protected abstract void |
sendCommand(String command)
Sends the specified command to the Skype client on the platform dependent
communication layer.
|
protected void |
sendProtocol()
Sends the Skype API protocol version to use.
|
void |
setApplicationName(String newApplicationName)
Sets the application name used to get the access grant of Skype API.
|
void |
setCommandTimeout(int newCommandTimeout)
Sets the command reply timeout of this connector.
|
void |
setConnectTimeout(int newConnectTimeout)
Sets the connect timeout of this connector.
|
void |
setDebug(boolean on)
Enable or disable debug printing for more information.
|
void |
setDebugOut(PrintStream newDebugOut)
Sets the debug output stream.
|
void |
setDebugOut(PrintWriter newDebugOut)
Sets the debug output stream.
|
protected static void |
setInstance(Connector newInstance)
Sets the instance of the connector for test cases.
|
protected void |
setStatus(Connector.Status newStatus)
Sets the status of this connector.
|
void |
setStringProperty(String name,
String value)
Sets the specified property.
|
Future |
waitForEndWithId(String command,
String responseHeader,
NotificationChecker checker)
Executes the specified command and gets the future using a command ID.
|
protected Connector()
public static Connector getInstance()
protected static void setInstance(Connector newInstance) throws ConnectorException
newInstance - The new instance.ConnectorException - thrown when instance is not valid.public String getInstalledPath()
public final void setDebug(boolean on)
throws ConnectorException
on - if true debug output will be written to System.outConnectorException - thrown when connection to Skype Client has gone bad.public final void setDebugOut(PrintWriter newDebugOut)
newDebugOut - the new debug output streamNullPointerException - if the specified new debug out is nullsetDebugOut(PrintStream),
getDebugOut()public final void setDebugOut(PrintStream newDebugOut)
newDebugOut - the new debug output streamNullPointerException - if the specified new debug out is nullsetDebugOut(PrintWriter),
getDebugOut()public final PrintWriter getDebugOut()
setDebugOut(PrintWriter),
setDebugOut(PrintStream)public final void setApplicationName(String newApplicationName)
newApplicationName - the application nameNullPointerException - if the specified application name is nullgetApplicationName()public final String getApplicationName()
setApplicationName(String)protected final void setStatus(Connector.Status newStatus)
newValue - the new statusNullPointerException - if the specified status is nullgetStatus()public final Connector.Status getStatus()
setStatus(com.skype.connector.Connector.Status)public final void setConnectTimeout(int newConnectTimeout)
newConnectTimeout - the new connect timeout in millisecondsIllegalArgumentException - if the new connect timeout is not more than 0getConnectTimeout()public final int getConnectTimeout()
setConnectTimeout(int)public final void setCommandTimeout(int newCommandTimeout)
newCommandTimeout - the new command reply timeout in millisecondsIllegalArgumentException - if the new command reply timeout is not more than 0getCommandTimeout()public final int getCommandTimeout()
setCommandTimeout(int)public final Connector.Status connect() throws ConnectorException
ConnectorException - if trying to connect failedNotAttachedException - if the Skype client is not runningprotected final void initialize()
throws ConnectorException
ConnectorException - if the initialization failed.protected abstract void initializeImpl()
throws ConnectorException
ConnectorException - if the initialization failed.protected abstract Connector.Status connect(int timeout) throws ConnectorException
timeout - the connect timeout in milliseconds to use while connecting.ConnectorException - if the trying to connect failed.protected void sendApplicationName(String applicationName) throws ConnectorException
applicationName - the application nameConnectorException - if sending the specified application name failedprotected void sendProtocol()
throws ConnectorException
ConnectorException - if sending the protocol version failedpublic final void dispose()
throws ConnectorException
ConnectorException - if cleaning up the resources failedprotected abstract void disposeImpl()
throws ConnectorException
ConnectorException - if cleaning up the resources failedpublic boolean isRunning()
throws ConnectorException
ConnectorException - if checking the Skype client status failed@Deprecated public final void execute(String command, MessageProcessor processor) throws ConnectorException
command - the command to executeprocessor - the message processorNullPointerException - if the specified command or processor is nullConnectorException - if executing the command failedpublic final String execute(String command) throws ConnectorException
executeWithId(String, String) because it returns the accurate
response.command - the command to executeNullPointerException - if the specified command is nullConnectorException - if executing the command failedexecuteWithId(String, String)public final String executeWithId(String command, String responseHeader) throws ConnectorException
command - the command to executeresponseHeader - the response header to get the accurate responseNullPointerException - if the specified command or responseHeader is nullConnectorException - if executing the command failedpublic final Future waitForEndWithId(String command, String responseHeader, NotificationChecker checker) throws ConnectorException
command - the command to executeresponseHeader - the response header to get the accurate first responsechecker - the notification checker to detect the endNullPointerException - if the specified command, responseHeader or checker is nullConnectorException - if executing the command failedpublic final String executeWithoutTimeout(String command, String responseHeader) throws ConnectorException
command - the command to executeresponseHeader - the response header to get the accurate responseNullPointerException - if the specified command or responseHeader is nullConnectorException - if executing the command failedpublic final String execute(String command, String responseHeader) throws ConnectorException
command - the command to executeresponseHeader - the response header to get the accurate responseNullPointerException - if the specified command or responseHeader is nullConnectorException - if executing the command failedpublic final String execute(String command, String[] responseHeaders) throws ConnectorException
command - the command to executeresponseHeaders - the response headers to get the accurate responseNullPointerException - if the specified command or responseHeader is nullConnectorException - if executing the command failedprotected final String execute(String command, String[] responseHeaders, boolean checkAttached) throws ConnectorException
command - the command to executeresponseHeaders - the response headers to get the accurate responsecheckAttached - if true check if this connector is attachedNullPointerException - if the specified command or responseHeader is nullConnectorException - if executing the command failedprotected abstract void sendCommand(String command)
command - the command to be executedpublic final void addConnectorListener(ConnectorListener listener) throws ConnectorException
listener - the listener to be addedNullPointerException - if the specified listener is nullConnectorException - if trying to connect failedremoveConnectorListener(ConnectorListener)public final void addConnectorListener(ConnectorListener listener, boolean checkAttached) throws ConnectorException
listener - the listener to be addedcheckAttached - if true checks if this connector is attachedNullPointerException - if the specified listener is nullConnectorException - if trying to connect failedremoveConnectorListener(ConnectorListener)public final void addConnectorListener(ConnectorListener listener, boolean checkAttached, boolean isSynchronous) throws ConnectorException
listener - the listener to be addedcheckAttached - if true checks if this connector is attachedisSynchronous - if true the listener will be handled synchronouslyNullPointerException - if the specified listener is nullConnectorException - if trying to connect failedremoveConnectorListener(ConnectorListener)public final void removeConnectorListener(ConnectorListener listener)
listener - the listener to be removedNullPointerException - if the specified listener is nulladdConnectorListener(ConnectorListener)protected final void fireMessageReceived(String message)
message - the message that triggered the eventpublic final void setStringProperty(String name, String value)
name - the property namevalue - the property valueNullPointerException - if the specified name is nullgetStringProperty(String)public final String getStringProperty(String name)
name - the property nameNullPointerException - if the specified name is nullsetStringProperty(String, String)Copyright © 2013. All Rights Reserved.