public abstract class WmNotificationListener extends java.lang.Object implements java.lang.Runnable, ResourceDomainDataProvider, com.wm.pkg.art.metadata.BaseTemplate, WmAdapterUIResourceDomainLookUp
Modifier and Type | Field and Description |
---|---|
protected java.lang.Throwable |
_lastError
The last error, if any.
|
protected com.wm.lang.ns.NSName |
_listenerNodeName |
protected int |
_retryCount
Counts the number of consecutive retries to attempted for this listener to get it up.
|
protected com.wm.pkg.art.ns.ListenerNodeStatistics |
_statistics
Statistics for this listener.
|
Constructor and Description |
---|
WmNotificationListener() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.Boolean |
adapterCheckValue(java.lang.String serviceName,
java.lang.String resourceDomainName,
java.lang.String[][] values,
java.lang.String testValue)
Checks a resourceDomain value.
|
abstract ResourceDomainValues[] |
adapterResourceDomainLookup(java.lang.String serviceName,
java.lang.String resourceDomainName,
java.lang.String[][] values)
Looks up values for a resourceDomain.
|
protected abstract void |
beginTransaction()
Sets up a transaction.
|
protected abstract void |
checkTransaction()
Called to ensure no transaction is currently associated with this Thread.
|
protected void |
cleanup()
Cleans up the listener after each execution attempt.
|
protected abstract void |
commit()
Commits the current transaction.
|
protected NotificationEvent |
createNotificationEvent(java.lang.Object data)
Creates a generic NotificationEvent by default.
|
void |
discoverParameters(AdapterParameters ap)
Does a double-dispatch to the AdapterParameters object.
|
protected void |
doShutdown()
Runs the shutdown sequence, handling all error and transactionality issues.
|
void |
execute()
This method runs one iteration of the listener.
|
abstract void |
fillWmDescriptor(WmDescriptor descriptor,
java.util.Locale locale)
Registers non-bean-based metadata with the Integration Server.
|
void |
fillWmUIDescriptor(WmUIDescriptor descriptor,
java.util.Locale locale)
Registers non-bean-based UI metadata with the Integration Server.
|
java.lang.Throwable |
getLastError()
Returns the last error.
|
java.lang.String |
getLastErrorMessage()
Returns the last error message.
|
com.wm.pkg.art.ns.ListenerNode |
getListenerNode()
Returns the listener node for this listener.
|
java.lang.String |
getLoggableName() |
java.util.List |
getRegisteredNotifications()
Returns the notifications (as WmListenerNotification objects), in the order in
which they were registered.
|
com.wm.pkg.art.ns.ListenerNodeStatistics |
getStatistics()
Returns the statistics for this listener.
|
protected void |
handleFatalException(java.lang.Throwable t) |
protected void |
handleRecoverableException(java.lang.Throwable t) |
void |
initialize()
Initializes listener resources during node registration.
|
void |
initListenerNodeProperties(com.wm.pkg.art.ns.ListenerNode nodeObj)
This method is called by the Listener manager when a
node is created.
|
abstract void |
listenerShutdown()
Adapter writers implement this method to perform shutdown processing
for the listener.
|
abstract void |
listenerStartup()
Adapter writers implement this method to initialize a listener.
|
protected void |
logCallback(java.lang.String callbackName)
Logs the callback.
|
void |
logDebugPlus(int minorCode,
java.lang.String param1,
java.lang.String param2)
Logs with a plus value of 1, with the FAC_ART_LISTENER facility code.
|
protected void |
logDebugPlusNamed(int minorCode)
Logs with a plus value of 1, with the FAC_ART_LISTENER facility code, and
adding the listener node name, or the unknown value from the resource
bundle, if not found.
|
protected void |
logDebugPlusNamed(int minorCode,
java.lang.String param)
Logs with a plus value of 1, with the FAC_ART_LISTENER facility code, and
adding the listener node name, or the unknown value from the resource
bundle, if not found.
|
protected com.wm.pkg.art.error.DetailedException |
makeDetailedException(int minorCode)
Creates a detailed exception.
|
protected com.wm.pkg.art.error.DetailedException |
makeDetailedException(int minorCode,
java.lang.String param1)
Creates a detailed exception.
|
protected com.wm.pkg.art.error.DetailedException |
makeDetailedException(int minorCode,
java.lang.String param1,
java.lang.String param2,
java.lang.Throwable t)
Creates a detailed exception.
|
protected com.wm.pkg.art.error.DetailedException |
makeDetailedException(int minorCode,
java.lang.String param1,
java.lang.Throwable t)
Creates a detailed exception.
|
abstract void |
notifyEvent(int et)
Called to propogate the listener lifecycle events of startup,
copy, update, delete.
|
protected NotificationResults |
processNotification(WmListenerNotification notif,
java.lang.Object data)
This method is called to execute a single listener notification.
|
void |
processNotificationResults(NotificationResults results)
This method is called by the Integration Server after data has been received from the
resource and subsequently processed by the
WmListenerNotification object registered
to process this type of notification. |
void |
registerNotification(WmListenerNotification notif)
Registers a Notification with this listener.
|
abstract void |
registerResourceDomain(WmAdapterAccess access)
Sets a reference to the
WmAdapterAccess object. |
protected void |
resetRetryCount()
resets the retry counter.
|
LookUpResult |
resourceDomainLookup(java.lang.String lookUpKey,
java.lang.String lookUpValue,
java.lang.String[][] values)
Looks up values for a resourceDomain's dependents.
|
java.lang.String[] |
restrictNotificationTypes()
By default, a listener supports any notification type.
|
protected abstract void |
rollback()
Rolls back the current transaction.
|
void |
run()
Called to start the listener loop
|
void |
runListener()
This method implements the Listener logic.
|
com.wm.pkg.art.notification.NotificationExecution |
runNotifications(java.lang.Object data)
This method passes the received data to the first enabled Notification
that takes responsibility for it.
|
void |
setRegisteredNotifications(java.util.List notifications)
Sets the registration order of notifications (as WmListenerNotification objects).
|
void |
setup()
Sets up the listener prior to making the first execution attempt.
|
void |
unregisterNotification(WmListenerNotification notif)
Unregisters a Notification with this listener.
|
abstract java.lang.Object |
waitForData()
This method is called after the listener has been initialized.
|
protected volatile java.lang.Throwable _lastError
protected volatile com.wm.lang.ns.NSName _listenerNodeName
protected volatile int _retryCount
protected volatile com.wm.pkg.art.ns.ListenerNodeStatistics _statistics
public abstract java.lang.Boolean adapterCheckValue(java.lang.String serviceName, java.lang.String resourceDomainName, java.lang.String[][] values, java.lang.String testValue) throws AdapterException
Boolean.TRUE
if
testValue is valid in this context, Boolean.FALSE
if it is
not valid, or null
if the value can't be confirmed by the
adapter.
Implement this method if your adapter supports resourceDomains. Return
null
if you are not able to confirm the value. Otherwise,
return Boolean.TRUE
if the value is valid, or
Boolean.FALSE
if the value is not valid.
When a user types a value into the operation editor that is displaying
an incomplete resourceDomain (ResourceDomainValues
.complete
is false)
and the ResourceDomainValues
.canValidate
flag is true.
adapterCheckValue
in interface ResourceDomainDataProvider
serviceName
- the name of the service templateresourceDomainName
- the name of the resourceDomainvalues
- the values for the resourceDomain parameterstestValue
- the value to testBoolean.TRUE
if testValue
is valid
in this context, Boolean.FALSE
if it is not
valid, or null
if the value can't be confirmed
by the adapter.AdapterException
- if something went wrongpublic abstract ResourceDomainValues[] adapterResourceDomainLookup(java.lang.String serviceName, java.lang.String resourceDomainName, java.lang.String[][] values) throws AdapterException
ResourceDomainValues
class with the proper data. Return multiple classes
if you are using tuples.adapterResourceDomainLookup
in interface ResourceDomainDataProvider
serviceName
- the name of the service/notification templateresourceDomainName
- the name of the resourceDomainvalues
- the values for the resourceDomain parametersAdapterException
- if something went wrongprotected abstract void beginTransaction() throws javax.resource.ResourceException
javax.resource.ResourceException
protected abstract void checkTransaction() throws javax.resource.ResourceException
javax.resource.ResourceException
protected void cleanup()
cleanup
method invokes this one.protected abstract void commit() throws javax.resource.ResourceException
javax.resource.ResourceException
protected NotificationEvent createNotificationEvent(java.lang.Object data)
public void discoverParameters(AdapterParameters ap) throws AdapterException
AdapterException
protected void doShutdown()
public void execute()
setup
,
runListener
, handleFatalException
, and cleanup
. For more
detail, see the documentation for those methods.public abstract void fillWmDescriptor(WmDescriptor descriptor, java.util.Locale locale) throws javax.resource.ResourceException
fillWmDescriptor
in interface com.wm.pkg.art.metadata.BaseTemplate
descriptor
- the WmDescriptor object to be populatedlocale
- the Locale used for UI based metadatajavax.resource.ResourceException
- if a processing error has occuredWmDescriptor
public void fillWmUIDescriptor(WmUIDescriptor descriptor, java.util.Locale locale) throws javax.resource.ResourceException
descriptor
- the WmUIDescriptor object to be populatedlocale
- the Locale used for UI based metadatajavax.resource.ResourceException
- if a processing error has occuredWmDescriptor
public java.lang.Throwable getLastError()
public java.lang.String getLastErrorMessage()
public com.wm.pkg.art.ns.ListenerNode getListenerNode() throws com.wm.pkg.art.error.DetailedException
com.wm.pkg.art.error.DetailedException
public java.lang.String getLoggableName()
getLoggableName
in interface com.wm.app.b2b.server.jca.LogDescriptor
public java.util.List getRegisteredNotifications()
public com.wm.pkg.art.ns.ListenerNodeStatistics getStatistics()
protected void handleFatalException(java.lang.Throwable t)
protected void handleRecoverableException(java.lang.Throwable t) throws com.wm.pkg.art.error.DetailedException
com.wm.pkg.art.error.DetailedException
public void initialize()
setup
method invokes this one.public final void initListenerNodeProperties(com.wm.pkg.art.ns.ListenerNode nodeObj) throws com.wm.pkg.art.error.DetailedException
nodeName
- The NS name for the listener node. It may not
be null.com.wm.pkg.art.error.DetailedException
- Thrown if an error occurs.public abstract void listenerShutdown()
public abstract void listenerStartup() throws javax.resource.ResourceException
javax.resource.ResourceException
- an instance of AdapterException for a non-recoverable error
or AdapterConnectionException for a recoverable connection-based errorprotected void logCallback(java.lang.String callbackName)
public void logDebugPlus(int minorCode, java.lang.String param1, java.lang.String param2)
protected void logDebugPlusNamed(int minorCode)
protected void logDebugPlusNamed(int minorCode, java.lang.String param)
protected com.wm.pkg.art.error.DetailedException makeDetailedException(int minorCode)
protected com.wm.pkg.art.error.DetailedException makeDetailedException(int minorCode, java.lang.String param1)
protected com.wm.pkg.art.error.DetailedException makeDetailedException(int minorCode, java.lang.String param1, java.lang.String param2, java.lang.Throwable t)
protected com.wm.pkg.art.error.DetailedException makeDetailedException(int minorCode, java.lang.String param1, java.lang.Throwable t)
public abstract void notifyEvent(int et) throws com.wm.pkg.art.error.DetailedException
et
- The type of event that just occured. It must match one of the
constants NOTIFY_UPDATE, NOTIFY_DELETE, NOTIFY_INIT, NOTIFY_STARTUP,
NOTIFY_SHUTDOWN, NOTIFY_ENABLE, NOTIFY_DISABLEcom.wm.pkg.art.error.DetailedException
protected NotificationResults processNotification(WmListenerNotification notif, java.lang.Object data) throws javax.resource.ResourceException
javax.resource.ResourceException
public void processNotificationResults(NotificationResults results) throws javax.resource.ResourceException
WmListenerNotification
object registered
to process this type of notification. The resulting NotificationResults
object is then passed into this method.
Adapter writers may implement this method to process a NotificationResults
object. This object will be either an AsyncNotificationResults
instance, if the
notification was processed by a WmAsyncListenerNotification
, or a
SyncNotificationResults
instance, if the notification was processed by a
WmSyncListenerNotification
. This method is always called after data is processed
even if the listener is shutting down. If an AdapterConnectionException
is
thrown from this method, the listener will be restarted.results
- the results returned by the notification processing. It may be an
instance of AsyncNotificationResults or SyncNotificationResults.javax.resource.ResourceException
- an instance of AdapterException
for a
non-recoverable error or AdapterConnectionException for a recoverable connection based errorWmListenerNotification.runNotification(com.wm.adk.notification.NotificationEvent)
public void registerNotification(WmListenerNotification notif)
public abstract void registerResourceDomain(WmAdapterAccess access) throws AdapterException
WmAdapterAccess
object. Will be called
after the constructor has been called, but before any
properties are set. The reference to WmAdapterAccess should be
stored for later use, if needed.
Register resourceDomain, using
addResourceDomainLookup
,
addResourceDomain
, etc.) in this method.
registerResourceDomain
in interface ResourceDomainDataProvider
access
- reference to WmAdapterAccess objectAdapterException
- something went wrongprotected void resetRetryCount()
public LookUpResult resourceDomainLookup(java.lang.String lookUpKey, java.lang.String lookUpValue, java.lang.String[][] values) throws AdapterException
WmAdapterUIResourceDomainLookUp
ResourceDomainValues
class with the proper
data. Returns multiple objects if you are using tuples.resourceDomainLookup
in interface WmAdapterUIResourceDomainLookUp
lookUpKey
- the system name of the lookUpKeylookUpValue
- the value of the lookUpKeyvalues
- the values for the UI parametersAdapterException
- if it encounters an error.public java.lang.String[] restrictNotificationTypes()
protected abstract void rollback() throws javax.resource.ResourceException
javax.resource.ResourceException
public void run()
run
in interface java.lang.Runnable
public void runListener() throws javax.resource.ResourceException, java.lang.Throwable
javax.resource.ResourceException
- if a processing error has occuredjava.lang.Throwable
public com.wm.pkg.art.notification.NotificationExecution runNotifications(java.lang.Object data) throws javax.resource.ResourceException
javax.resource.ResourceException
public void setRegisteredNotifications(java.util.List notifications)
public void setup() throws javax.resource.ResourceException
setup
method invokes this one.javax.resource.ResourceException
public void unregisterNotification(WmListenerNotification notif)
public abstract java.lang.Object waitForData() throws javax.resource.ResourceException
AdapterConnectionException
is thrown from
this method, the listener will be restarted.
javax.resource.ResourceException
- an instance of AdapterException for a non-recoverable error
or AdapterConnectionException for a recoverable connection-based error
Copyright © 2003 - 2021 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.