|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.skype.connector.Connector
public abstract class Connector
Base class for all platform specific connectors. A connector connects the Skype Java API with a running Skype client.
Nested Class Summary | |
---|---|
static class |
Connector.Status
Enumeration of the connector status. |
Constructor Summary | |
---|---|
protected |
Connector()
Because this object should be a singleton the constructor is protected. |
Method Summary | |
---|---|
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. |
static void |
useJNIConnector(boolean on)
To use the win32 dll instead of the SWT library please use this method. |
Future |
waitForEndWithId(String command,
String responseHeader,
NotificationChecker checker)
Executes the specified command and gets the future using a command ID. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Connector()
Method Detail |
---|
public static void useJNIConnector(boolean on)
on
- If true the win32 connector will be used.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.out
ConnectorException
- thrown when connection to Skype Client has gone bad.public final void setDebugOut(PrintWriter newDebugOut)
newDebugOut
- the new debug output stream
NullPointerException
- if the specified new debug out is nullsetDebugOut(PrintStream)
,
getDebugOut()
public final void setDebugOut(PrintStream newDebugOut)
newDebugOut
- the new debug output stream
NullPointerException
- 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 name
NullPointerException
- if the specified application name is nullgetApplicationName()
public final String getApplicationName()
setApplicationName(String)
protected final void setStatus(Connector.Status newStatus)
newValue
- the new status
NullPointerException
- 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 milliseconds
IllegalArgumentException
- 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 milliseconds
IllegalArgumentException
- 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 failed
NotAttachedException
- 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 name
ConnectorException
- 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 processor
NullPointerException
- if the specified command or processor is null
ConnectorException
- 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 execute
NullPointerException
- if the specified command is null
ConnectorException
- 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 response
NullPointerException
- if the specified command or responseHeader is null
ConnectorException
- 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 end
NullPointerException
- if the specified command, responseHeader or checker is null
ConnectorException
- 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 response
NullPointerException
- if the specified command or responseHeader is null
ConnectorException
- 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 response
NullPointerException
- if the specified command or responseHeader is null
ConnectorException
- 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 response
NullPointerException
- if the specified command or responseHeader is null
ConnectorException
- 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 attached
NullPointerException
- if the specified command or responseHeader is null
ConnectorException
- 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 added
NullPointerException
- if the specified listener is null
ConnectorException
- 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 attached
NullPointerException
- if the specified listener is null
ConnectorException
- 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 synchronously
NullPointerException
- if the specified listener is null
ConnectorException
- if trying to connect failedremoveConnectorListener(ConnectorListener)
public final void removeConnectorListener(ConnectorListener listener)
listener
- the listener to be removed
NullPointerException
- 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 value
NullPointerException
- if the specified name is nullgetStringProperty(String)
public final String getStringProperty(String name)
name
- the property name
NullPointerException
- if the specified name is nullsetStringProperty(String, String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |