net.m2technologies.open_arm.transport.transaction.snmp
Class SnmpMediator

java.lang.Object
  extended bynet.m2technologies.open_arm.transport.transaction.AbstractTransactionMediatorImpl
      extended bynet.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator
All Implemented Interfaces:
ArmInterface, ArmTransaction, ArmTransactionWithMetrics, TransactionMediator, TransportMediator

public class SnmpMediator
extends AbstractTransactionMediatorImpl

Copyright 2005 Mark Masterson

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Description: This class outputs the information for a given transaction as SNMP v.2c traps.

You should provide a properties file for this class within its classpath/classloader scope. The name of the properties file must be the value of the PROPERTIES_FILE_NAME constant defined in this class. Within this properties file, you should define 7 properties; the managment host that traps should be sent to, the port that the managment host listens for traps on, the enterprise OID that define your company's/application's traps, the application trap OID that defines traps sent by your application, the time interval that you want as a threshold that must be exceeded before a trap is sent, the same sort of threshold for updates, and a boolean flag that determines whether or not blocking events should be forwarded as traps.

These properties must take the following form: "[standard prefix].[attribute name]=[value]", where the [standard prefix] element must be "net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator" , and the 7 attribute names are:

"managementHost", "managementHostTrapListenPort", "enterpriseOID", "applicationTrapOIDValue", "transactionLengthInterval", "updateLengthInterval", "isBlockedEventTrap".

A sample properties file might therefore look like the following:


< net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator.managementHost=127.0.0.1
net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator.managementHostTrapListenPort=162
net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator.enterpriseOID=1.3.6.1.2.1.2.0
net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator.applicationTrapOIDValue=1.3.6.1.2.1.2.0.0.0.0
net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator.transactionLengthInterval=5000
net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator.updateLengthInterval=5000
net.m2technologies.open_arm.transport.transaction.snmp.SnmpMediator.isBlockedEventTrap=false

The sample above also shows the default values that this class will use for each of these attributes, if you do not provide a properties file, or if you omit one or more of the attributes.

Version:
0.009
Author:
Mark Masterson

Field Summary
static java.lang.String PROPERTIES_FILE_NAME
          Value = "open_arm_snmp_trap.properties"
 
Constructor Summary
SnmpMediator(java.lang.Object transactionDelegate)
           
 
Method Summary
protected  void doBlocked(long tmpHandle)
          Sends a trap with the standard 'blocked' message text.
protected  void doStop(long elapsedTime, long totalElapsedTime, int status, java.lang.String diagnosticDetail)
          Sends a trap with the standard 'stop' message text.
protected  void doUnblocked(long blockHandle)
          Sends a trap with the standard 'unblocked' message text.
protected  void doUpdate(long runningTime, long totalRunningTime)
          Sends a trap with the standard 'update' message text.
 void setConfiguration(java.lang.Object configuration)
           
 
Methods inherited from class net.m2technologies.open_arm.transport.transaction.AbstractTransactionMediatorImpl
bindThread, blocked, getApplication, getBlockedMessage, getContextURIValue, getContextValue, getCorrelator, getCreatingFactory, getDefinition, getDelegate, getErrorCode, getErrorMessage, getMetricGroup, getParentCorrelator, getStatus, getStopMessage, getTransactionWithMetricsDefinition, getUnblockedMessage, getUpdateMessage, getUser, isTraceRequested, reset, setArrivalTime, setContextURIValue, setContextValue, setErrorCode, setTraceRequested, setTransactionalDelegate, setUser, start, start, start, start, stop, stop, unbindThread, unblocked, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_FILE_NAME

public static final java.lang.String PROPERTIES_FILE_NAME
Value = "open_arm_snmp_trap.properties"

See Also:
Constant Field Values
Constructor Detail

SnmpMediator

public SnmpMediator(java.lang.Object transactionDelegate)
Method Detail

setConfiguration

public void setConfiguration(java.lang.Object configuration)

doBlocked

protected void doBlocked(long tmpHandle)
Sends a trap with the standard 'blocked' message text. Appends a ".1" to the application trap OID value defined in the properties file (the default is "1.3.6.1.2.1.2.0.0.0.0").

Specified by:
doBlocked in class AbstractTransactionMediatorImpl
Parameters:
tmpHandle -

doStop

protected void doStop(long elapsedTime,
                      long totalElapsedTime,
                      int status,
                      java.lang.String diagnosticDetail)
Sends a trap with the standard 'stop' message text. Appends a ".2" to the application trap OID value defined in the properties file (the default is "1.3.6.1.2.1.2.0.0.0.0").

Specified by:
doStop in class AbstractTransactionMediatorImpl
Parameters:
elapsedTime -
totalElapsedTime -
status -
diagnosticDetail -

doUnblocked

protected void doUnblocked(long blockHandle)
Sends a trap with the standard 'unblocked' message text. Appends a ".3" to the application trap OID value defined in the properties file (the default is "1.3.6.1.2.1.2.0.0.0.0").

Specified by:
doUnblocked in class AbstractTransactionMediatorImpl
Parameters:
blockHandle -

doUpdate

protected void doUpdate(long runningTime,
                        long totalRunningTime)
Sends a trap with the standard 'update' message text. Appends a ".4" to the application trap OID value defined in the properties file (the default is "1.3.6.1.2.1.2.0.0.0.0").

Specified by:
doUpdate in class AbstractTransactionMediatorImpl
Parameters:
runningTime -
totalRunningTime -