public static class DOFObject.DefaultProvider extends java.lang.Object implements DOFObject.Provider
DOFObject.Provider
. You can extend this class, rather than implementing DOFObject.Provider
,
when you do not need to further extend your class and you only wish to override a portion of the methods in the full DOFObject.Provider
interface. For example, if the DOF interface you are providing contains only read-only properties, you can extend DefaultProvider
and override only the get method, allowing calls to all other methods to be responded to by the parent DefaultProvider class. Using
DefaultProvider for such implementations often results in much more compact and elegant code.Constructor and Description |
---|
DefaultProvider() |
Modifier and Type | Method and Description |
---|---|
void |
complete(DOFOperation operation,
DOFException exception)
Called when the library receives notification that an operation is complete.
|
void |
get(DOFOperation.Provide operation,
DOFRequest.Get request,
DOFInterface.Property property)
Called when the library generates a
DOFRequest.Get . |
void |
invoke(DOFOperation.Provide operation,
DOFRequest.Invoke request,
DOFInterface.Method method,
java.util.List<DOFValue> parameters)
Called when the library generates a
DOFRequest.Invoke . |
void |
register(DOFOperation.Provide operation,
DOFRequest.Register request,
DOFInterface.Event event)
Called when the library generates a
DOFRequest.Register . |
void |
registerComplete(DOFOperation.Provide operation,
DOFRequest.Register request,
DOFInterface.Event event)
Called when a provider receives notification that a register operation is complete.
|
void |
session(DOFOperation.Provide operation,
DOFRequest.Session request,
DOFObject object,
DOFInterfaceID interfaceID,
DOFObjectID sessionID,
DOFInterfaceID sessionType)
Called when the library generates a
DOFRequest.Session . |
void |
sessionComplete(DOFOperation.Provide operation,
DOFRequest.Session request,
DOFObject object,
DOFInterfaceID interfaceID,
DOFObjectID sessionID,
DOFInterfaceID sessionType)
Called when a provider receives notification that a session is complete.
|
void |
set(DOFOperation.Provide operation,
DOFRequest.Set request,
DOFInterface.Property property,
DOFValue value)
Called when the library generates a
DOFRequest.Set . |
void |
subscribe(DOFOperation.Provide operation,
DOFRequest.Subscribe request,
DOFInterface.Property property,
int minPeriod)
Called when the library generates a
DOFRequest.Subscribe . |
void |
subscribeComplete(DOFOperation.Provide operation,
DOFRequest.Subscribe request,
DOFInterface.Property property)
Called when a provider receives notification that a subscribe operation is complete.
|
public void get(DOFOperation.Provide operation, DOFRequest.Get request, DOFInterface.Property property)
DOFRequest.Get
. Also called after the subscribe(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Subscribe, org.opendof.core.oal.DOFInterface.Property, int)
method returns
when the library generates a DOFRequest.Subscribe
. Unless overridden, this method responds with an exception stating that
get has not been implemented. For more information, see DOFObject.Provider.get(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Get, org.opendof.core.oal.DOFInterface.Property)
.get
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the request. This will never be null. Call one of the
DOFRequest.Get.respond(org.opendof.core.oal.DOFValue)
methods to return results or to throw exceptions.
DOFProviderException should be thrown for any error condition that is defined as an
exception in the DOFInterface.
DOFErrorException should be thrown for any error condition that falls outside of the
exceptions defined in the DOFInterface.property
- The property on which the 'Get' was requested. This will never be null.DOFRequest.Get.respond(DOFValue)
,
DOFRequest.Get.respond(DOFProviderException)
,
DOFRequest.Get.respond(DOFErrorException)
,
DOFObject.GetOperationListener
,
DOFOperation
public void set(DOFOperation.Provide operation, DOFRequest.Set request, DOFInterface.Property property, DOFValue value)
DOFRequest.Set
. Unless overridden, this method responds with an exception stating that
set has not been implemented. For more information, see DOFObject.Provider.set(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Set, org.opendof.core.oal.DOFInterface.Property, org.opendof.core.oal.DOFValue)
.set
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the request. This will never be null. Call one of the
DOFRequest.Get.respond(org.opendof.core.oal.DOFValue)
methods to indicate 'Set' complete or to throw exceptions.
DOFProviderException should be thrown for any error condition that is defined as an
exception in the DOFInterface.
DOFErrorException should be thrown for any error condition that falls outside of the
exceptions defined in the DOFInterface.property
- The property on which the 'Set' was requested. This will never be null.value
- The value to assign to the property. This will never be null.DOFRequest.Set.respond()
,
DOFRequest.Set.respond(DOFProviderException)
,
DOFRequest.Set.respond(DOFErrorException)
,
DOFObject.SetOperationListener
,
DOFOperation
public void invoke(DOFOperation.Provide operation, DOFRequest.Invoke request, DOFInterface.Method method, java.util.List<DOFValue> parameters)
DOFRequest.Invoke
. Unless overridden, this method responds with an exception stating that
invoke has not been implemented. For more information, see DOFObject.Provider.invoke(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Invoke, org.opendof.core.oal.DOFInterface.Method, java.util.List<org.opendof.core.oal.DOFValue>)
.invoke
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the request. This will never be null. Call one of the
DOFRequest.Get.respond(org.opendof.core.oal.DOFValue)
methods to return results or to throw exceptions.
DOFProviderException should be thrown for any error condition that is defined as an
exception in the DOFInterface.
DOFErrorException should be thrown for any error condition that falls outside of the
exceptions defined in the DOFInterface.method
- The method being invoked. This will never be null.parameters
- The method's parameter list. This will never be null.DOFRequest.Invoke.respond(DOFValue...)
,
DOFRequest.Invoke.respond(java.util.List)
,
DOFRequest.Invoke.respond(DOFProviderException)
,
DOFRequest.Invoke.respond(DOFErrorException)
,
DOFObject.InvokeOperationListener
,
DOFOperation
public void subscribe(DOFOperation.Provide operation, DOFRequest.Subscribe request, DOFInterface.Property property, int minPeriod)
DOFRequest.Subscribe
. Unless overridden, this method does nothing other than call
DOFRequest.Subscribe.respond()
, which then triggers the get(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Get, org.opendof.core.oal.DOFInterface.Property)
method. For more information, see DOFObject.Provider.subscribe(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Subscribe, org.opendof.core.oal.DOFInterface.Property, int)
and DOFObject.Provider.get(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Get, org.opendof.core.oal.DOFInterface.Property)
.subscribe
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the subscribe request. This will never be null. Use this to return, indicating that the 'subscribe' is accepted
(use request.respond()
) or to throw exceptions (use
request.respond(...)
).
DOFErrorException should be thrown for any error condition that falls outside of the
exceptions defined in the DOFInterface, the subscribe is not supported for the property, or the
minPeriod is unacceptable.property
- The property being subscribed to. This will never be null.minPeriod
- The minimum time, in milliseconds, that should elapse between property update notifications.DOFRequest.Subscribe.respond(DOFErrorException)
,
DOFSubscription.Listener
,
DOFOperation
public void subscribeComplete(DOFOperation.Provide operation, DOFRequest.Subscribe request, DOFInterface.Property property)
DOFObject.Provider.subscribeComplete(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Subscribe, org.opendof.core.oal.DOFInterface.Property)
.subscribeComplete
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the subscribe request. This will never be null.property
- The property being unsubscribed from. This will never be null.public void register(DOFOperation.Provide operation, DOFRequest.Register request, DOFInterface.Event event)
DOFRequest.Register
. Unless overridden, this method does nothing other than call
DOFRequest.Register.respond()
. For more information, see DOFObject.Provider.register(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Register, org.opendof.core.oal.DOFInterface.Event)
.register
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the register request. This will never be null. Use this to return, indicating that the 'register' is accepted
(use request.respond()
) or to throw exceptions (use
request.respond(...)
).
DOFErrorException should be thrown for any error condition that falls outside of the
exceptions defined in the DOFInterface, or the register is not supported for the event.event
- The event that a handler is being registered on. This will never be null.DOFRegistration.Listener
,
DOFOperation
public void registerComplete(DOFOperation.Provide operation, DOFRequest.Register request, DOFInterface.Event event)
DOFObject.Provider.registerComplete(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Register, org.opendof.core.oal.DOFInterface.Event)
.registerComplete
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- information about the register request. This will never be null.event
- The event associated with the handler which has been unregistered. This will never be null.public void session(DOFOperation.Provide operation, DOFRequest.Session request, DOFObject object, DOFInterfaceID interfaceID, DOFObjectID sessionID, DOFInterfaceID sessionType)
DOFRequest.Session
. Unless overridden, this method responds with an exception stating that
session has not been implemented. For more information, see DOFObject.Provider.session(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Session, org.opendof.core.oal.DOFObject, org.opendof.core.oal.DOFInterfaceID, org.opendof.core.oal.DOFObjectID, org.opendof.core.oal.DOFInterfaceID)
.session
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the request. This will never be null. Use this to Use this to return, indicating that the
Session has been initiated (use request.respond()
) or to throw exceptions (use
request.respond(...)
).
DOFProviderException should be thrown for any error condition that is defined as an
exception in the DOFInterface.
DOFErrorException should be thrown for any error condition that falls outside of the
exceptions defined in the DOFInterface.object
- The object the session is being requested on. This will never be null.interfaceID
- Any interfaceID that the specific provider must be currently providing in order to receive this request. This will never be null.sessionID
- The session object identifier. This uniquely identifies the session and includes a Session Attribute chosen by the requestor.
A DOFObject may be created directly from this id to provide interfaces on the session. This will never be null.sessionType
- The requested session type (a DOFInterfaceID
), defining the purpose and contract for the session. This interface should typically be provided on the session
(possibly in addition to others), but no specific behavior is required. This will never be null.DOFRequest.Session.respond(DOFErrorException)
,
DOFObject.SessionOperationListener
,
DOFOperation
public void sessionComplete(DOFOperation.Provide operation, DOFRequest.Session request, DOFObject object, DOFInterfaceID interfaceID, DOFObjectID sessionID, DOFInterfaceID sessionType)
DOFObject.Provider.registerComplete(org.opendof.core.oal.DOFOperation.Provide, org.opendof.core.oal.DOFRequest.Register, org.opendof.core.oal.DOFInterface.Event)
.sessionComplete
in interface DOFObject.Provider
operation
- Information about the corresponding provide operation. This will never be null.request
- Information about the request. This will never be null.object
- The object the session was requested on. This will never be null.interfaceID
- The interfaceID the session was requested on. This will never be null.sessionID
- The session object identifier. This will never be null.sessionType
- The session type. This will never be null.public void complete(DOFOperation operation, DOFException exception)
DOFOperation.OperationListener.complete(org.opendof.core.oal.DOFOperation, org.opendof.core.oal.DOFException)
.complete
in interface DOFOperation.OperationListener
operation
- The operation that has completed. This will never be null.
NOTE: It is possible to extend the time for the operation by calling DOFOperation.setTimeout(int)
.
If an operation is extended, complete() will be called again.exception
- An exception which caused completion of the operation (typically DOFErrorException.TIMEOUT
or DOFException.FAILED
).
If null, the operation completed normally.
NOTE: Normal completion is not the same as "success." Even if the operation completed "normally", the Provider may still have
returned an exception that was received in one of the other methods of this OperationListener.