|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.indy.BaseComponent | +--org.indy.IndyComponent
IndyComponent
is the ancestor of all Indy components
which implement client or server functionality.
IndyComponent
provides a convinient method to acess the local
machine's host name with getLocalName()
, and is also responsible for
firing events to registered instances of IndyComponentListener
to signal state change, input,
and output operations in the component.
IndyComponentListener
Inner Class Summary | |
static class |
IndyComponent.WorkMode
An enumerated class representing the possible work types for siganalling work events in an IndyComponent |
Constructor Summary | |
IndyComponent()
|
Method Summary | |
void |
addComponentListener(IndyComponentListener listener)
Registers an IndyComponentListener to receive events from this component instance. |
protected void |
doBeginWork(IndyComponent.WorkMode workMode)
Calls to signal the beginning of work of a given IndyComponent.WorkMode . |
protected void |
doBeginWork(IndyComponent.WorkMode workMode,
int size)
Called to indicate the beginning of work of the given IndyComponent.WorkMode . |
protected void |
doEndWork(IndyComponent.WorkMode workMode)
Signals that a piece of work begun by doBeginWork
has ended. |
protected void |
doStatus(Status status)
Fires a status event with the given Status . |
protected void |
doStatus(Status status,
java.lang.Object[] args)
Fires a state change event for a given Status ,
taking an array of arguments for message formatting. |
protected void |
doWork(IndyComponent.WorkMode workMode,
int count)
Signals that a piece of work of the given IndyComponent.WorkMode is underway
to the tune of count bytes. |
static java.lang.String |
getLocalName()
Returns the local host name of this machine. |
void |
removeComponentListener(IndyComponentListener listener)
Unregisters an IndyComponentListener from this component. |
Methods inherited from class org.indy.BaseComponent |
getVersion |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public IndyComponent()
Method Detail |
public static final java.lang.String getLocalName() throws IndyUnknownHostException
NOTE: This value is lazily created and then cached, so that, at present, changes to the host name will not update.
This method provides a shortcut for
java.net.InetAddress.getLocalHost().getHostName();
IndyUnknownHostException
- if, for some reason, the local host can not be resolvedSecurityExeption
- if a security manager exists and checkConnect
doesn't allow this operation.protected final void doStatus(Status status)
Status
.
This is a shortcut for
doStatus(status, new Object[0]);
status
- The Status
that represents the state being changed to.Status
protected final void doStatus(Status status, java.lang.Object[] args)
Status
,
taking an array of arguments for message formatting.
The message formatting uses java.text.MessageFormat, and the appropriate resource string
for the Status
in question.status
- The Status
being changed to.args
- Arguments to format the state change message with.public void addComponentListener(IndyComponentListener listener)
IndyComponentListener
to receive events from this component instance.listener
- The IndyComponentListener
to receive events from this component.IndyComponentListener
public void removeComponentListener(IndyComponentListener listener)
IndyComponentListener
from this component.listener
- The IndyComponentListener
to remove.IndyComponentListener
protected void doBeginWork(IndyComponent.WorkMode workMode, int size)
IndyComponent.WorkMode
.
Calls can be nested, but each begin must have a corresponding end.
Only the first beginWork in any nested set for a given WorkMode
will fire a IndyComponentListener#onBeginWork(IndyComponent,WorkMode,int)
event.workMode
- The WorkMode
of this work.size
- The size of the work - viz. how many bytes are being read, written or processed.doBeginWork(WorkMode)
,
doEndWork(WorkMode)
,
doWork(WorkMode,int)
,
IndyComponentListener
,
IndyComponentListener#onBeginWork(IndyComponent,WorkMode,int)
protected final void doBeginWork(IndyComponent.WorkMode workMode)
IndyComponent.WorkMode
.
See for more details.
This method is a shortcut for
doBeginWork(workMode,0);
workMode
- The WorkMode
describing the type of operation underway.doBeginWork(WorkMode,int)
,
doEndWork(WorkMode)
,
doWork(WorkMode,int)
,
IndyComponentListener
,
IndyComponentListener#onBeginWork(IndyComponent,WorkMode,int)
protected final void doWork(IndyComponent.WorkMode workMode, int count)
IndyComponent.WorkMode
is underway
to the tune of count
bytes.
This call will have no effect unless a corresponding call to begin work has been made;
otherwise a onWork
event will be fired to all interested parties.workMode
- The WorkMode
that this work represents.count
- The number of bytes being processed.doBeginWork(WorkMode,int)
,
doEndWork(WorkMode,int)
,
IndyComponent.WorkMode
,
IndyComponentListener
,
IndyComponentListener.onWork(IndyComponent, IndyComponent.WorkMode, int)
protected final void doEndWork(IndyComponent.WorkMode workMode)
doBeginWork
has ended.
Each call to doBeginWork
should have a corresponding call to doEndWork
,
and, as with doBeginWork
only the innovation representing the outermost portion of
work in a nested call will trigger an event, in this case IndyComponentListener#onEndWork(IndyComponent,WorkMode)
.workMode
- The WorkMode
for which work is ending.doBeginWork(WorkMode,int)
,
doBeginWork(WorkMode)
,
doWork(WorkMode,int)
,
IndyComponent.WorkMode
,
IndyComponentListener
,
IndyComponentListener#onEndWork(IndyComponent,WorkMode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |