|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectRvProcessor
Provides an easy interface for creating and manipulating "rendezvous
sessions" as well as sending and receiving individual rendezvous commands
nested in RV ICBM's.
This class manages rendezvous "sessions" as follows. Every rendezvous command
contains a unique session ID. For example, if you attempt to send a file to
someone, and that person rejects the file transfer, each of those commands
will (normally) contain the same session ID, as they pertain to the same
"session": the file transfer you initiated. This class recognizes such
sessions and creates appropriate RvSession instances for each
new rendezvous session created. It is certainly possible to use rendezvous
sessions without using a RvProcessor, but this class attempts
to make session management and RvCommand generation simpler and
somewhat transparent to the developer.
This class will generate exceptions in the attached SNAC processor's attached
FLAP processor's exception handler should any exceptions occur when running
callbacks or RV command factory methods.
| Exception type | Meaning | Reason object |
|---|---|---|
ERRTYPE_RV_CMD_GEN | This type indicates that an
exception was thrown when attempting to convert an incoming RV ICBM to a
RvCommand using a RvCommandFactory's
genRvCommand method. | The reason object in this case will
be the RecvRvIcbm whose attempted processing caused the given
exception. |
ERRTYPE_RV_LISTENER | This type indicates that an
exception was thrown when calling a method of a
RvProcessorListener. | The reason object in this case
will be the RvProcessorListener which threw the
exception. |
ERRTYPE_RV_SESSION_LISTENER | This type indicates that
an exception was thrown when calling a method of a
RvSessionListener attached to a specific
RvSession. | The reason object in this case is the
RvSessionListener that threw the exception. |
ClientSnacProcessor, an instance of this class will intercept
all RecvRvIcbms and all RvResponses. After
attaching an RV processor to a given SNAC processor, that SNAC processor's
packet listeners will no longer receive packet events for either of these two
commands (until detaching the RV processor).
RvProcessor is not attached to a SNAC processor,
all attempts at sending rendezvous commands and responses (via RvSession.sendRv(net.kano.joscar.snaccmd.icbm.RvCommand) and RvSession.sendResponse(int) will be quietly
ignored.
RvProcessor uses the Java Logging API namespace
"net.kano.joscar.rv", logging various events at the levels
Level.FINE and Level.FINER, in order to, hopefully,
ease the debugging of rendezvous-related applications. For more information
on how to log such events, consult the Java Logging API reference at the J2SE website.
| Field Summary | |
static java.lang.Object |
ERRTYPE_RV_CMD_GEN
A FLAP exception handler error type indicating that an exception was thrown when generating a RvCommand with an attached
RvCommandFactory. |
static java.lang.Object |
ERRTYPE_RV_LISTENER
A FLAP exception handler error type indicating that an exception was thrown when calling a method of an attached RvProcessorListener. |
static java.lang.Object |
ERRTYPE_RV_SESSION_LISTENER
A FLAP exception handler error type indicating that an exception was thrown when calling a method of an RvSessionListener attached to an
RvSession. |
| Constructor Summary | |
RvProcessor()
Creates a RV processor which is not attached to any SNAC processor and which contains no RvCommand factories or new session
listeners. |
|
RvProcessor(ClientSnacProcessor snacProcessor)
Creates a RV processor attached to the given SNAC processor and which contains no RvCommand factories or new session
listeners. |
|
| Method Summary | |
void |
addListener(RvProcessorListener l)
Adds the given RV processor listener to this processor's listener list. |
void |
attachToSnacProcessor(ClientSnacProcessor snacProcessor)
"Attaches" this RV processor to the given SNAC processor. |
RvSession |
createRvSession(java.lang.String sn)
Creates a new "outgoing" rendezvous session with the given user and a new unique session ID. |
RvSession |
createRvSession(java.lang.String sn,
long sessionID)
Creates a new "outgoing" rendezvous session with the given user and the given session ID. |
void |
detach()
"Detaches" this RV processor from the currently attached SNAC processor, if any. |
RvCommandFactory |
getRegisteredRvCmdFactory(CapabilityBlock cap)
Returns the RvCommand factory that is registered for the
given capability (rendezvous type). |
ClientSnacProcessor |
getSnacProcessor()
Returns the SNAC processor to which this RV processor is currently attached, or null if none is attached. |
void |
registerRvCmdFactory(CapabilityBlock cap,
RvCommandFactory factory)
Registers the given RvCommand factory for the given
capability (that is, RV type). |
void |
registerRvCmdFactory(RvCommandFactory factory)
Registers a new RvCommand factory with this
RvProcessor. |
void |
removeListener(RvProcessorListener l)
Removes the given RV processor from this processor's listener list, if present. |
void |
unregisterRvCmdFactory(CapabilityBlock cap,
RvCommandFactory factory)
Unregisters the given RV command factory for the given RV type (capability). |
void |
unregisterRvCmdFactory(RvCommandFactory factory)
Unregisters the given RV command factory for all RV types for which it is currently registered. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.Object ERRTYPE_RV_CMD_GEN
RvCommand with an attached
RvCommandFactory. See above for
details.
public static final java.lang.Object ERRTYPE_RV_LISTENER
RvProcessorListener. See
above for details.
public static final java.lang.Object ERRTYPE_RV_SESSION_LISTENER
RvSessionListener attached to an
RvSession. See above for details.
| Constructor Detail |
public RvProcessor()
RvCommand factories or new session
listeners.
public RvProcessor(ClientSnacProcessor snacProcessor)
RvCommand factories or new session
listeners.
snacProcessor - the SNAC processor to which to attachattachToSnacProcessor(net.kano.joscar.snac.ClientSnacProcessor)| Method Detail |
public final ClientSnacProcessor getSnacProcessor()
null if none is attached.
public final void attachToSnacProcessor(ClientSnacProcessor snacProcessor)
detach(); that is, an RV processor cannot
be attached to more than one SNAC processor.
snacProcessor - the SNAC processor to which this RV processor should
attachdetach()public final void detach()
public final void addListener(RvProcessorListener l)
l - the RV processor listener to addpublic final void removeListener(RvProcessorListener l)
l - the listener to removepublic final void registerRvCmdFactory(RvCommandFactory factory)
RvCommand factory with this
RvProcessor. The given factory will be used to generate
RvCommands for incoming rendezvouses of the types specified
in its supported capabilities.
factory - the RV command factory to register
public final void registerRvCmdFactory(CapabilityBlock cap,
RvCommandFactory factory)
RvCommand factory for the given
capability (that is, RV type). The given factory will be used to generate
RvCommands from incoming RV packets of the given type
(capability). Note that if cap is null, the
given factory will be used as a "fallback" factory, being used to
generate commands whose types (capabilities) have no associated factory.
cap - the "type" or "capability" for which the given factory should
be used, or null to handle all types for which a
factory is not explicitly definedfactory - the RV command factory to use for the given rendezvous
typepublic final RvCommandFactory getRegisteredRvCmdFactory(CapabilityBlock cap)
RvCommand factory that is registered for the
given capability (rendezvous type). If cap is
null, the "fallback factory" is returned. See above for
details.
null will be
returned if no factory is explicitly registered for the given type
(unless, of course, cap is null, as stated
above).
cap - the capability (rendezvous type) whose registered RV command
factory should be returned, or null to return the
"fallback factory"
RvCommandFactory registered for the given RV
type, or null if no factory is registered for that
typepublic final void unregisterRvCmdFactory(RvCommandFactory factory)
factory - the RV command factory to fully unregister
public final void unregisterRvCmdFactory(CapabilityBlock cap,
RvCommandFactory factory)
cap is
null, the given factory is unregistered as the "fallback
factory" (if, of course, it is currently the fallback factory). See
above for details.
cap - the RV type for which the given factory should be unregisteredfactory - the factory that should be unregistered from the given
RV typepublic final RvSession createRvSession(java.lang.String sn)
NewRvSessionEvent of
type TYPE_OUTGOING
will be fired.
sn - the screenname of the user with whom to create a new session
RvSession with the given user
public final RvSession createRvSession(java.lang.String sn,
long sessionID)
NewRvSessionEvent of
type TYPE_OUTGOING
will be fired.
sn - the screenname of the user with whom to create a new sessionsessionID - a session ID number to use for the created session
RvSession with the given user
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||