|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jdesktop.beans.AbstractBean
org.jdesktop.ws.BaseService
public abstract class BaseService
An abstact class useful as a base for asynchronous data service classes. For example, HttpService is a useful subclass for executing REST like webservice calls at a low level. WebService is a useful class which embodies one or more Operations (which are instances of BaseService) and which is useful for executing SOAP requests.
One could also imagine the creation of FtpService, SshService, SftpService, DatabaseService, and other such non http-based services.
BaseService serves as a base class for creating asynchronous Swing-friendly web service APIs. All events fired from BaseService are fired on the EDT, and it is assumed that all methods invoked on BaseService are likewise invoked on the Event Dispatching Thread (EDT).
| Constructor Summary | |
|---|---|
protected |
BaseService()
Creates a new BaseService. |
| Method Summary | |
|---|---|
void |
abort()
Aborts the current request. |
void |
addAbortListener(AbortListener listener)
Adds an AbortListener |
void |
addDoneListener(DoneListener listener)
Adds a DoneListener. |
void |
addFailureListener(FailureListener listener)
Adds a FailureListener |
protected abstract void |
doAbort()
Invoked by this AbstractHttpService, this method performs the actual chores behind aborting the asynchronous process. |
protected void |
done()
Called by the subclass when the background process completes successfully. |
protected abstract void |
doSend()
Invoked by this AbstractHttpService, this method performs the actual send operation. |
void |
fail(Throwable th)
Invoke this method from subclasses to force the connection to fail. |
protected void |
fireOnEDT(String prop,
Object oldv,
Object newv)
Fires the given property change event on the EDT in a manner that avoids calling invokeLater for every property change event. |
float |
getProgress()
Property indicating the upload or download progress. |
State |
getState()
Property indicating the state of the service. |
void |
removeAbortListener(AbortListener listener)
Removes an AbortListener |
void |
removeDoneListener(DoneListener listener)
Removes a DoneListener |
void |
removeFailureListener(FailureListener listener)
Removes a FailureListener |
void |
send()
Initiates the request/response cycle by sending a request to the remote service. |
protected void |
setProgress(float p)
Sets the progress. |
protected void |
setState(State s)
Sets the local state property, firing a property change event on the EventDispatchThread if necessary. |
| Methods inherited from class org.jdesktop.beans.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected BaseService()
| Method Detail |
|---|
public final State getState()
protected void setState(State s)
s - public final float getProgress()
state of the service. A value of
-1 indicates that progress is not trackable, either because it is
indeterminate or because the State is not Sending or Receiving. All
states other than Sending or Receiving will always indicate a value of
-1, except for SENT and DONE.
This is a float value between 0-1 when it is valid.
protected void setProgress(float p)
p - public final void send()
state property or add one or more of
DoneListener, FailureListener, AbortListener.
public final void abort()
public void fail(Throwable th)
th -
protected abstract void doSend()
throws Exception
Exceptionprotected abstract void doAbort()
protected final void done()
protected final void fireOnEDT(String prop,
Object oldv,
Object newv)
prop - oldv - newv - public final void addDoneListener(DoneListener listener)
listener - public final void removeDoneListener(DoneListener listener)
listener - public void addAbortListener(AbortListener listener)
listener - public void removeAbortListener(AbortListener listener)
listener - public void addFailureListener(FailureListener listener)
listener - public void removeFailureListener(FailureListener listener)
listener -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||