TARGET
- The Type of resource that will be created.PARENT
- The Type of this resource's parent.INFO
- The Type of JmsResource used to describe the target resource.ENDPOINT
- The AMQP Endpoint that the target resource encapsulates.public abstract class AmqpResourceBuilder<TARGET extends AmqpResource,PARENT extends AmqpResourceParent,INFO extends JmsResource,ENDPOINT extends org.apache.qpid.proton.engine.Endpoint> extends Object implements AmqpEventSink
Modifier and Type | Field and Description |
---|---|
protected ENDPOINT |
endpoint |
protected PARENT |
parent |
protected AsyncResult |
request |
protected ScheduledFuture<?> |
requestTimeoutTask |
protected TARGET |
resource |
protected INFO |
resourceInfo |
Constructor and Description |
---|
AmqpResourceBuilder(PARENT parent,
INFO resourceInfo) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterOpened()
Called once an endpoint has been opened and validated to give the subclasses a
place to perform any follow-on processing or setup steps before the operation
is deemed to have been completed and success is signaled.
|
void |
buildResource(AsyncResult request)
Called to initiate the process of building the resource type that is
managed by this builder.
|
protected abstract ENDPOINT |
createEndpoint(INFO resourceInfo)
Given the resource information provided create and configure the local endpoint
whose open phase is managed by this builder.
|
protected abstract TARGET |
createResource(PARENT parent,
INFO resourceInfo,
ENDPOINT endpoint)
Create the managed resource instance.
|
ENDPOINT |
getEndpoint() |
protected Exception |
getOpenAbortException()
When aborting the open operation, and there isn't an error condition,
provided by the peer, the returned exception will be used instead.
|
PARENT |
getParent() |
AsyncResult |
getRequest() |
protected long |
getRequestTimeout()
Returns the configured time before the open of the resource is considered
to have failed.
|
TARGET |
getResource() |
INFO |
getResourceInfo() |
protected void |
handleClosed(AmqpProvider provider,
Throwable cause) |
protected void |
handleOpened(AmqpProvider provider) |
protected boolean |
hasRemoteError() |
protected abstract boolean |
isClosePending()
If the resource was opened but its current state indicates a close is pending
then we do no need to proceed further into the resource creation process.
|
protected boolean |
isOpenedEndpointValid()
Following the open of the endpoint implementations of this method should validate
that the endpoint properties match what was requested.
|
void |
processDeliveryUpdates(AmqpProvider provider)
Called when the Proton Engine signals an Delivery related event has been triggered
for the given endpoint.
|
void |
processFlowUpdates(AmqpProvider provider)
Called when the Proton Engine signals an Flow related event has been triggered
for the given endpoint.
|
void |
processRemoteClose(AmqpProvider provider)
Event handler for remote peer close of this resource.
|
void |
processRemoteDetach(AmqpProvider provider)
Event handler for remote peer detach of this resource.
|
void |
processRemoteOpen(AmqpProvider provider)
Event handler for remote peer open of this resource.
|
protected AsyncResult request
protected ScheduledFuture<?> requestTimeoutTask
protected TARGET extends AmqpResource resource
protected ENDPOINT extends org.apache.qpid.proton.engine.Endpoint endpoint
protected final PARENT extends AmqpResourceParent parent
protected final INFO extends JmsResource resourceInfo
public void buildResource(AsyncResult request)
request
- The request that initiated the resource creation.public void processRemoteOpen(AmqpProvider provider) throws IOException
AmqpEventSink
processRemoteOpen
in interface AmqpEventSink
provider
- the AmqpProvider instance for easier access to fire events.IOException
- if an error occurs while processing the update.public void processRemoteClose(AmqpProvider provider) throws IOException
AmqpEventSink
processRemoteClose
in interface AmqpEventSink
provider
- the AmqpProvider instance for easier access to fire events.IOException
- if an error occurs while processing the update.public void processRemoteDetach(AmqpProvider provider) throws IOException
AmqpEventSink
processRemoteDetach
in interface AmqpEventSink
provider
- the AmqpProvider instance for easier access to fire events.IOException
- if an error occurs while processing the update.public void processDeliveryUpdates(AmqpProvider provider) throws IOException
AmqpEventSink
processDeliveryUpdates
in interface AmqpEventSink
provider
- the AmqpProvider instance for easier access to fire events.IOException
- if an error occurs while processing the update.public void processFlowUpdates(AmqpProvider provider) throws IOException
AmqpEventSink
processFlowUpdates
in interface AmqpEventSink
provider
- the AmqpProvider instance for easier access to fire events.IOException
- if an error occurs while processing the update.protected final void handleOpened(AmqpProvider provider)
protected final void handleClosed(AmqpProvider provider, Throwable cause)
protected abstract ENDPOINT createEndpoint(INFO resourceInfo)
protected abstract TARGET createResource(PARENT parent, INFO resourceInfo, ENDPOINT endpoint)
parent
- The parent of the newly created resource.resourceInfo
- The resource information used to configure the resource.endpoint
- The local endpoint for the managed resource to wrap.protected abstract boolean isClosePending()
protected boolean isOpenedEndpointValid()
protected void afterOpened()
protected boolean hasRemoteError()
protected Exception getOpenAbortException()
protected long getRequestTimeout()
public ENDPOINT getEndpoint()
public AsyncResult getRequest()
public TARGET getResource()
public PARENT getParent()
public INFO getResourceInfo()
Copyright © 2013–2016 The Apache Software Foundation. All rights reserved.