com.ibm.wsspi.timedoperations

Interface TimedOperationsTransformDescriptor



  • public interface TimedOperationsTransformDescriptor

    TimedOperationsTransformDescriptor is used to define the various "Timed Operations" which the user wants to monitor. Each instance of TimedOperationsTransformDescriptor defines a single timed operation configuration.

    The following is an example snippet:
     
     
     public class MyTimedOperationDefination implements com.ibm.wsspi.timedoperations.TimedOperationsTransformDescriptor
     
          private static final String classToInstrument = "com/mypackage/MyClass";
          private static final String methodToInstrument = "myMethod";
          private static final String descOfMethod = "(Ljava.lang.String)V";
          private static final String timedOpsType = "SOME_STATIC_TYPE";
     
          public String getClassName()
                  return classToInstrument;
          }
     
          public String getMethodName() {
                  return methodToInstrument;
          }
     
          public String getType() {
                  return timedOpsType;
          }
     
          public String getMethodDesc() {
                  return descOfMethod;
          }
     
          public String getPattern(Object instanceOfThisClass, Object methodArgs) {
                  String rcString = "";
     
                  //If an instance of 'com.mypackage.MyClass' is useful, then use it and get the correct message for this timed operation
                  if (instanceOfThisClass != null){
                          com.mypackage.MyClass passedInstance = (com.mypackage.MyClass) instanceOfThisClass;
                          //Do something here with this object and get the right meta data String and assign to rcString;
                  }
     
                  //If helpful you can use the argument (String in this case) in your method
                  //Get the necessary data from arguments and assign to rcString;
                  if(methodArgs!=null){
                          Object[] params = null;
                          if (Object[].class.isInstance(methodArgs)) {
                                  params = (Object[]) methodArgs;
                                  for (int i = 0; i < params.length; i++) {
                                          System.out.println("ARG "+i+" = "+params[i] );
                                  }
                          }
                  }
                  return rcString;
          }
     } 
     
     
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String getClassName()
      Returns the name of class, which needs to be monitored.
      java.lang.String getMethodDesc()
      Returns the Method Descriptor which belongs to above class/method (see getClassName() and see getMethodName()).
      java.lang.String getMethodName()
      Returns the name of method which belongs to above class (see getClassName()), which needs to be monitored.
      java.lang.String getPattern(java.lang.Object thisInstance, java.lang.Object objArrays)
      Get pattern of Timed Operation.
      java.lang.String getType()
      Type of Timed Operation.
    • Method Detail

      • getClassName

        java.lang.String getClassName()
        Returns the name of class, which needs to be monitored. ClassName must be in the form of classname including complete package name. e.g. com/mypkg/MyClass
        Returns:
        Returns the Name of Class, which needs to be monitored for Timed Operation.
      • getMethodName

        java.lang.String getMethodName()
        Returns the name of method which belongs to above class (see getClassName()), which needs to be monitored. If method is overridden, getMethodDesc() will be used to differentiate it.
        Returns:
        Name of method which need to be monitored for TimedOperation.
      • getMethodDesc

        java.lang.String getMethodDesc()
        Returns the Method Descriptor which belongs to above class/method (see getClassName() and see getMethodName()).
        Returns:
        Description of Method to differentiate overloaded method defined in getMethodName().
      • getType

        java.lang.String getType()
        Type of Timed Operation. This would be used as type argument to getTimedOperation(type, pattern) method in TimedOperationService class.
        Returns:
        Type of TimedOperations.
      • getPattern

        java.lang.String getPattern(java.lang.Object thisInstance,
                                  java.lang.Object objArrays)
        Get pattern of Timed Operation. This would be used as pattern argument to getTimedOperation(type, pattern) method in TimedOperationService class.
        Parameters:
        thisInstance - thisInstance is the instance of class, which is used for timed operation. (Same class defined in getClassName();)
        objArrays - Actual parameter objects which are passed to method, defined by getMethodName()
        Returns:
        Pattern to identify the Timed Operation Instance.