|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.pipe.PipeServiceImpl
public class PipeServiceImpl
A JXTA PipeService
implementation which implements the
standard JXTA Pipe Resolver Protocol (PRP).
PipeService
,
InputPipe
,
OutputPipe
,
Message
,
PipeAdvertisement
,
PipeResolverMessage
,
JXTA Protocols Specification : Pipe Binding ProtocolField Summary | |
---|---|
(package private) static long |
VERIFYINTERVAL
the interval at which we verify that a pipe is still resolved at a remote peer. |
Fields inherited from interface net.jxta.pipe.PipeService |
---|
PropagateType, UnicastSecureType, UnicastType |
Fields inherited from interface net.jxta.platform.Module |
---|
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK |
Constructor Summary | |
---|---|
PipeServiceImpl()
Default Constructor (don't delete) |
Method Summary | |
---|---|
InputPipe |
createInputPipe(PipeAdvertisement adv)
Create an InputPipe from a pipe Advertisement |
InputPipe |
createInputPipe(PipeAdvertisement adv,
PipeMsgListener listener)
Create an InputPipe from a pipe Advertisement |
OutputPipe |
createOutputPipe(PipeAdvertisement pipeAdv,
long timeout)
Attempt to create an OutputPipe using the specified Pipe Advertisement. |
void |
createOutputPipe(PipeAdvertisement pipeAdv,
OutputPipeListener listener)
Attempt to create an OutputPipe using the specified Pipe Advertisement. |
OutputPipe |
createOutputPipe(PipeAdvertisement adv,
Set<? extends ID> resolvablePeers,
long timeout)
Attempt to create an OutputPipe using the specified Pipe Advertisement. |
void |
createOutputPipe(PipeAdvertisement pipeAdv,
Set<? extends ID> resolvablePeers,
OutputPipeListener listener)
Attempt to create an OutputPipe using the specified Pipe Advertisement. |
ModuleImplAdvertisement |
getImplAdvertisement()
Returns the advertisement for this service. |
PipeService |
getInterface()
Service objects are not manipulated directly to protect usage of the service. |
void |
init(PeerGroup group,
ID assignedID,
Advertisement impl)
Initialize the module, passing it its peer group and advertisement. |
boolean |
pipeNAKEvent(PipeResolver.Event event)
A NAK Event was received for this pipe |
boolean |
pipeResolveEvent(PipeResolver.Event event)
Pipe Resolve event |
OutputPipeListener |
removeOutputPipeListener(ID pipeID,
OutputPipeListener listener)
Remove an OutputPipeListener previously registered with createOuputputPipe . |
OutputPipeListener |
removeOutputPipeListener(String pipeID,
OutputPipeListener listener)
Remove an OutputPipeListener previously registered with createOuputputPipe . |
int |
startApp(String[] args)
Complete any remaining initialization of the module. |
void |
stopApp()
Stop a module. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final long VERIFYINTERVAL
Constructor Detail |
---|
public PipeServiceImpl()
Method Detail |
---|
public PipeService getInterface()
getInterface
in interface Service
public ModuleImplAdvertisement getImplAdvertisement()
getImplAdvertisement
in interface Service
ModuleImplAdvertisement
.public void init(PeerGroup group, ID assignedID, Advertisement impl)
init
in interface Module
group
- The PeerGroup from which this Module can obtain services.
If this module is a Service, this is also the PeerGroup of which this
module is a service.assignedID
- Identity of Module within group.
modules can use it as a the root of their namespace to create
names that are unique within the group but predictable by the
same module on another peer. This is normally the ModuleClassID
which is also the name under which the module is known by other
modules. For a group it is the PeerGroupID itself.
The parameters of a service, in the Peer configuration, are indexed
by the assignedID of that service, and a Service must publish its
run-time parameters in the Peer Advertisement under its assigned ID.impl
- The implementation advertisement for this
Module. It is permissible to pass null if no implementation
advertisement is available. This may happen if the
implementation was selected by explicit class name rather than
by following an implementation advertisement. Modules are not
required to support that style of loading, but if they do, then
their documentation should mention it.public int startApp(String[] args)
startApp()
is completed. That is
also the opportunity to supply arbitrary arguments (mostly to
applications).
If this module is a PeerGroup
service, it may be invoked
several times depending on its return value.
Currently this service does not expect arguments.
startApp
in interface Module
args
- An array of Strings forming the parameters for this
Module.
Module.START_OK
, Module.START_AGAIN_PROGRESS
,
Module.START_AGAIN_STALLED
, which indicates partial or complete
success, or any other value (negative values are
recommended for future compatibility), which indicates failure.public void stopApp()
init()
completes and should not assume that startApp()
has been
called or completed.
The Module cannot be forced to comply, but in the future
we might be able to deny it access to anything after some timeout.
stopApp
in interface Module
public InputPipe createInputPipe(PipeAdvertisement adv) throws IOException
createInputPipe
in interface PipeService
adv
- The advertisement of the Pipe.
IOException
- error creating input pipepublic InputPipe createInputPipe(PipeAdvertisement adv, PipeMsgListener listener) throws IOException
createInputPipe
in interface PipeService
adv
- is the advertisement of the Pipe.listener
- PipeMsgListener to receive msgs.
IOException
- Error creating input pipepublic OutputPipe createOutputPipe(PipeAdvertisement pipeAdv, long timeout) throws IOException
createOutputPipe
in interface PipeService
pipeAdv
- The advertisement of the pipe being resolved.timeout
- Time duration in milliseconds to wait for a successful
pipe resolution. 0 will wait indefinitely.
IOException
- If the pipe cannot be created or failed to resolve
within the specified time.public OutputPipe createOutputPipe(PipeAdvertisement adv, Set<? extends ID> resolvablePeers, long timeout) throws IOException
createOutputPipe
in interface PipeService
adv
- The advertisement of the pipe being resolved.resolvablePeers
- The peers on which the pipe may be resolved.
If the Set is empty then the pipe may be resolved to any
destination peer.timeout
- Time duration in milliseconds to wait for a successful
pipe resolution. 0 will wait indefinitely.
IOException
- If the pipe cannot be created or failed to resolve
within the specified time.public void createOutputPipe(PipeAdvertisement pipeAdv, OutputPipeListener listener) throws IOException
createOutputPipe
in interface PipeService
pipeAdv
- The advertisement of the pipe being resolved.listener
- The listener to be called when the pipe is resolved.
IOException
- If the pipe cannot be created.public void createOutputPipe(PipeAdvertisement pipeAdv, Set<? extends ID> resolvablePeers, OutputPipeListener listener) throws IOException
createOutputPipe
in interface PipeService
pipeAdv
- The advertisement of the pipe being resolved.resolvablePeers
- The set of peers on which the pipe may be resolved.
If the Set is empty then the pipe may be resolved to any
destination peer.listener
- the listener to be called when the pipe is resolved.
IOException
- If the pipe cannot be created.public OutputPipeListener removeOutputPipeListener(String pipeID, OutputPipeListener listener)
createOuputputPipe
.
removeOutputPipeListener
in interface PipeService
pipeID
- The pipe who's listener is to be removed.listener
- The listener to remove.
public OutputPipeListener removeOutputPipeListener(ID pipeID, OutputPipeListener listener)
createOuputputPipe
.
removeOutputPipeListener
in interface PipeService
pipeID
- The pipe who's listener is to be removed.listener
- The listener to remove.
public boolean pipeResolveEvent(PipeResolver.Event event)
pipeResolveEvent
in interface PipeResolver.Listener
event
- event the PipeResolver Event
public boolean pipeNAKEvent(PipeResolver.Event event)
pipeNAKEvent
in interface PipeResolver.Listener
event
- event the PipeResolver Event
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |