public class ITunesRemoteClient
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CMD_ADD_FILES
The ADDFILES command text
|
static java.lang.String |
CMD_CLEAR_FILES
The CLEARFILES command text
|
static java.lang.String |
CMD_FILE
The FILE command text
|
static java.lang.String |
CMD_HELO
The HELO command text
|
static java.lang.String |
CMD_LIST_DEAD_FILES
The LISTDEADFILES command text
|
static java.lang.String |
CMD_LOGIN
The LOGIN command text
|
static java.lang.String |
CMD_PASSWORD
The PASSWORD command text
|
static java.lang.String |
CMD_QUIT
The QUIT command text
|
static java.lang.String |
CMD_REFRESH_FILES
The REFRESHFILES command text
|
static java.lang.String |
CMD_REMOVE_DEAD_FILES
The REMOVEDEADFILES command text
|
static java.lang.String |
CMD_REMOVE_FILES
The REMOVEFILES command text
|
static long |
DEFAULT_TIMEOUT
The default timeout for commands that don't take a long time in seconds
|
static long |
NO_TIMEOUT
This can be used if no timeout is requried
|
Constructor and Description |
---|
ITunesRemoteClient()
The constructor
|
Modifier and Type | Method and Description |
---|---|
void |
connect(java.net.InetAddress hostname,
int port)
Used to connect to the server
|
void |
disconnect()
Used to disconnect from the server
|
void |
login(java.lang.String username,
java.lang.String password)
Used to login to the server
|
void |
run() |
void |
sendCommand(java.lang.String cmd,
int expectedCode,
long timeout)
Used to send a command to the server
|
protected void |
waitForCode(java.lang.String cmd,
int expectedCode,
long timeout) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final long DEFAULT_TIMEOUT
public static final long NO_TIMEOUT
public static final java.lang.String CMD_HELO
public static final java.lang.String CMD_QUIT
public static final java.lang.String CMD_LOGIN
public static final java.lang.String CMD_PASSWORD
public static final java.lang.String CMD_CLEAR_FILES
public static final java.lang.String CMD_ADD_FILES
public static final java.lang.String CMD_REMOVE_FILES
public static final java.lang.String CMD_REMOVE_DEAD_FILES
public static final java.lang.String CMD_LIST_DEAD_FILES
public static final java.lang.String CMD_REFRESH_FILES
public static final java.lang.String CMD_FILE
public void connect(java.net.InetAddress hostname, int port) throws StoreException
hostname
- The hostname of the serverport
- The port number of the hostStoreException
- Thrown if their is a problempublic void login(java.lang.String username, java.lang.String password) throws StoreException
username
- The username of the user connecting to the serverpassword
- The password of the user connecting to the serverStoreException
- Thrown if their is a problempublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void sendCommand(java.lang.String cmd, int expectedCode, long timeout) throws StoreException
cmd
- The command to set to the serverexpectedCode
- The expected return code if their are no errorstimeout
- the timeout in seconds, or -1 for no timeoutStoreException
- Thrown if their is a problemprotected void waitForCode(java.lang.String cmd, int expectedCode, long timeout) throws StoreException
StoreException
public void disconnect()