public static class Source.Config.Builder
extends java.lang.Object
Source.Config with the given parameters. The Builder's constructor contains the parameters that are required in order to construct a Source.Config.
All other parameters are optional.| Constructor and Description |
|---|
Builder(org.opendof.core.oal.DOFSystem system,
org.opendof.core.oal.DOFObjectID sourceID,
org.opendof.datatransfer.StatusListener statusListener,
DeliveryListener deliveryListener)
Constructs a new builder with the minimum information required to create a
Source. |
| Modifier and Type | Method and Description |
|---|---|
Source.Config |
build()
Constructs and returns a
Source.Config that contains all of the configuration parameters set in
this Builder. |
static org.opendof.core.oal.DOFObjectID |
generateInstanceID()
Creates a unique instance ID using a randomly generated GUID.
|
Source.Config.Builder |
setInstanceID(org.opendof.core.oal.DOFObjectID instanceID)
Set the unique instance identifier for the source.
|
Source.Config.Builder |
setMaxDeliveryPeriod(long maxDeliveryPeriod)
Set the maximum amount of time that the Source will wait for an acknowledgment before
reporting failure to the DeliveryListener.
|
Source.Config.Builder |
setOperationTimeout(int operationTimeout)
Set the timeout for synchronous network operations such as
Source.sendNotification(org.opendof.core.oal.DOFObjectID, org.opendof.core.oal.DOFObjectID, java.lang.String) and
Source.completeRequest(org.opendof.core.oal.DOFObjectID, long, org.opendof.datatransfer.DetailRequestStatus). |
Source.Config.Builder |
setRequestHandler(DataRequestHandler requestHandler)
Set the DataRequestHandler that will be notified of any incoming detailed data requests.
|
Source.Config.Builder |
setRetryTime(int retryTime)
Set the minimum amount of time that the source will wait before re-advertising ValueSets, Events or
TopologyUpdates.
|
Source.Config.Builder |
setThreadpoolSize(int size)
Sets the size of the source's threadpool.
|
public Builder(org.opendof.core.oal.DOFSystem system,
org.opendof.core.oal.DOFObjectID sourceID,
org.opendof.datatransfer.StatusListener statusListener,
DeliveryListener deliveryListener)
Source.system - The DOFSystem instance allowing this class to use OpenDOF to facilitate network communications.
This must not be null.sourceID - The ID of the source. If multiple instances use the same base ID then a unique
instance ID should be added to the sourceID. This can either be done by passing in a sourceID with
an added Provider attribute, or by calling setInstanceID(DOFObjectID) with an appropriate
instanceID.statusListener - The StatusListener for the source. This must not be null.deliveryListener - The DeliveryListener for the source. This must not be null.public Source.Config.Builder setThreadpoolSize(int size)
size - The size of the API's callback threadpool. Defaults to 10. Must be greater than 0 and less than 500.public Source.Config.Builder setInstanceID(org.opendof.core.oal.DOFObjectID instanceID)
generateInstanceID() may be used to create a unique instance ID using a randomly
generated GUID.instanceID - The unique instance identifier for the source.public static org.opendof.core.oal.DOFObjectID generateInstanceID()
setInstanceID(DOFObjectID) in order to uniquely identify a source instance.public Source.Config.Builder setRequestHandler(DataRequestHandler requestHandler)
requestHandler - The DataRequestHandler. Must not be null.public Source.Config.Builder setMaxDeliveryPeriod(long maxDeliveryPeriod)
maxDeliveryPeriod - The maximum amount of time that the Source will wait before failing.
maxDeliveryPeriod defaults to 1 hour if this method is not called. Must be greater
than 0;public Source.Config.Builder setRetryTime(int retryTime)
retryTime - The minimum amount of time that the source will wait before re-advertising ValueSets,
Events or TopologyUpdates.
retryTime defaults to 1 minute if this method is not called. Must not be less than 0.public Source.Config.Builder setOperationTimeout(int operationTimeout)
Source.sendNotification(org.opendof.core.oal.DOFObjectID, org.opendof.core.oal.DOFObjectID, java.lang.String) and
Source.completeRequest(org.opendof.core.oal.DOFObjectID, long, org.opendof.datatransfer.DetailRequestStatus).
The timeout for Source.submitValueSet(org.opendof.core.oal.DOFObjectID, org.opendof.datatransfer.ValueSet, long), Source.submitTopologyUpdate(org.opendof.core.oal.DOFObjectID, org.opendof.datatransfer.TopologyInformation, long, java.util.Date) and Source.submitEvent(org.opendof.core.oal.DOFObjectID, org.opendof.datatransfer.Event, long) depends
on the values passed into setRetryTime(int) and setMaxDeliveryPeriod(long) and will not be
affected by this call.operationTimeout - The timeout, in milliseconds, for synchronous Source operations. operationTimeout
defaults to
2 minutes if this method is not called. Must be greater than 0.public Source.Config build() throws java.lang.Exception
Source.Config that contains all of the configuration parameters set in
this Builder.java.lang.Exception - Thrown if a valid Config cannot be constructed.