Package org.eurekaJ.agent.model

Examples of org.eurekaJ.agent.model.ClassInstrumentationInfo


    return madeClass;
  }

  private ClassInstrumentationInfo getSubtypeInstrumentation(CtClass ctClass) {
    ClassInstrumentationInfo cii = null;
   
    //Check if class implements an instrumented interface
    for (CtClass currClassInterface : getImplementations(ctClass)) {
      ClassInstrumentationInfo cii2 = EurekaJAgentLauncher.getSubtypeInstrumentationHash().get(currClassInterface.getName().replaceAll("/", "."));
      if (cii2 != null && cii2.isDoesImplement()) {
        log.info("Class " + currClassInterface.getName().replaceAll("/", ".") + " is instrumented as implements. Instrumenting class: " + ctClass.getName());
        cii = cii2;
        break;
      }
    }
   
    //if interface is not instrumented, try superclass
    CtClass superClass = getSuperclass(ctClass);
    if (superClass != null) {
      //Class has a superclass
      ClassInstrumentationInfo cii2 = EurekaJAgentLauncher.getSubtypeInstrumentationHash().get(superClass.getName().replaceAll("/", "."));
      if (cii2 != null && cii2.isDoesExtend()) {
        cii = cii2;
      }
    }
   
       
View Full Code Here


       
    return cii;
  }

  private ClassInstrumentationInfo getWildcardInstrumentation(CtClass ctClass, String fullyQualifiedPackageName) {
    ClassInstrumentationInfo cii = null;

    String[] parts = fullyQualifiedPackageName.split("\\.");
    while (parts.length > 0) {
      // Slit package name and look back in the hierarchy
      String tempName = "";
      for (int i = 0; i < parts.length; i++) {
        tempName += parts[i] + ".";
      }
      tempName += "*";
      ClassInstrumentationInfo cii2 = EurekaJAgentLauncher.getInstrumentationHash().get(tempName);
      if (cii2 != null) { // Matching wildcard package
        cii = cii2;
        break;
      }
      // Reduce parts array by 1
View Full Code Here

    byte[] bytestream = null;
    boolean methodInstrumented = false;
    String fullyQualifiedPackageName = className.replace("/", ".");   

    //Get Subtype instrumentation (both extends and implements)
    ClassInstrumentationInfo cii = getSubtypeInstrumentation(currClass);
    if (cii == null) {
      //Try up to 6 levels up
      for (int i = 0; i < 10; i++) {
        CtClass superClass = getSuperclass(currClass);
        if (superClass != null) {
View Full Code Here

        Element instrumentation = (Element)instrumentationsList.item(i);
        StringBuilder sb = new StringBuilder();
        String methodName = getNodeValue(instrumentation, "method");
        String classType = getNodeValue(instrumentation, "classType");
       
        ClassInstrumentationInfo cii = new ClassInstrumentationInfo(getNodeValue(instrumentation, "package"),
            getNodeValue(instrumentation, "class"),
            methodName,
            classType,
            getNodeValue(instrumentation, "path"),
            getNodeValue(instrumentation, "extends"),
            getNodeValue(instrumentation, "implements"));
       
        if (cii.getPackageName().endsWith("*")) { //Wildcard No need for classname
          sb.append(cii.getPackageName());
        } else {
          sb.append(cii.getPackageName()).append(".").append(cii.getClassName());
        }
       
        if (cii.isDoesImplement() || cii.isDoesExtend()) {
          ClassInstrumentationInfo oldCii = subtypeInstrumentationHash.get(sb.toString());
          if (oldCii != null) { //Add method to existing instrumentation
            oldCii.getMethodNameHash().put(methodName, new MethodInstrumentation(methodName, classType));
          } else { //Add new ClassInstrumentationInfo
            subtypeInstrumentationHash.put(sb.toString(), cii);
          }
        } else {
          ClassInstrumentationInfo oldCii = instrumentationHash.get(sb.toString());
          if (oldCii != null) { //Add method to existing instrumentation
            oldCii.getMethodNameHash().put(methodName, new MethodInstrumentation(methodName, classType));
          } else { //Add new ClassInstrumentationInfo
            instrumentationHash.put(sb.toString(), cii);
          }
        }
       
View Full Code Here

TOP

Related Classes of org.eurekaJ.agent.model.ClassInstrumentationInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.