org.objectweb.dsrg.sofa.cushion.osgi
Class ServiceAnalyzer

java.lang.Object
  extended by org.objectweb.dsrg.sofa.cushion.osgi.ServiceAnalyzer
All Implemented Interfaces:
org.objectweb.asm.ClassVisitor

public class ServiceAnalyzer
extends java.lang.Object
implements org.objectweb.asm.ClassVisitor

Creates the transitive closure of a service interface

Author:
Karel Masek

Constructor Summary
ServiceAnalyzer(java.lang.ClassLoader loader)
          Contructor
 
Method Summary
 java.util.Map<java.lang.String,byte[]> analyze(java.lang.String iface)
          Inspect the service interface and create a transitive closure
 void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
          Visits the header of a class
 org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String desc, boolean visible)
          Visits an annotation
 void visitAttribute(org.objectweb.asm.Attribute attr)
          Visits a non standard attribute
 void visitEnd()
          Visits the end of the class
 org.objectweb.asm.FieldVisitor visitField(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.Object value)
          Visits a field of the class
 void visitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int access)
          Visits information about an inner class
 org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
           
 void visitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String desc)
          Visits the enclosing class of the class
 void visitSource(java.lang.String source, java.lang.String debug)
          Visits the source of the class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceAnalyzer

public ServiceAnalyzer(java.lang.ClassLoader loader)
Contructor

Parameters:
loader - ClassLoader to use
Method Detail

analyze

public java.util.Map<java.lang.String,byte[]> analyze(java.lang.String iface)
Inspect the service interface and create a transitive closure

Parameters:
iface - the service interface
Returns:
the transitive closure

visit

public void visit(int version,
                  int access,
                  java.lang.String name,
                  java.lang.String signature,
                  java.lang.String superName,
                  java.lang.String[] interfaces)
Visits the header of a class

Specified by:
visit in interface org.objectweb.asm.ClassVisitor
Parameters:
version - the class version
access - the access flags
name - the class internal name
signature - the signature
superName - the superclass name
interfaces - array of interfaces

visitMethod

public org.objectweb.asm.MethodVisitor visitMethod(int access,
                                                   java.lang.String name,
                                                   java.lang.String desc,
                                                   java.lang.String signature,
                                                   java.lang.String[] exceptions)
Specified by:
visitMethod in interface org.objectweb.asm.ClassVisitor

visitAnnotation

public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String desc,
                                                           boolean visible)
Visits an annotation

Specified by:
visitAnnotation in interface org.objectweb.asm.ClassVisitor
Parameters:
desc - the class description
visible - visibility at runtime
Returns:

visitAttribute

public void visitAttribute(org.objectweb.asm.Attribute attr)
Visits a non standard attribute

Specified by:
visitAttribute in interface org.objectweb.asm.ClassVisitor
Parameters:
attr - the attribute

visitField

public org.objectweb.asm.FieldVisitor visitField(int access,
                                                 java.lang.String name,
                                                 java.lang.String desc,
                                                 java.lang.String signature,
                                                 java.lang.Object value)
Visits a field of the class

Specified by:
visitField in interface org.objectweb.asm.ClassVisitor
Parameters:
access - the access flags
name - the field's name
desc - the description
signature - the signature
value - the initial value
Returns:
a visitor to visit field annotations and attributes, or null if this class visitor is not interested in visiting these annotations and attributes.

visitInnerClass

public void visitInnerClass(java.lang.String name,
                            java.lang.String outerName,
                            java.lang.String innerName,
                            int access)
Visits information about an inner class

Specified by:
visitInnerClass in interface org.objectweb.asm.ClassVisitor
Parameters:
name - the internal name of the class
outerName - the internal name of the outer class
innerName - the simple inner class name
access - the access flags

visitOuterClass

public void visitOuterClass(java.lang.String owner,
                            java.lang.String name,
                            java.lang.String desc)
Visits the enclosing class of the class

Specified by:
visitOuterClass in interface org.objectweb.asm.ClassVisitor
Parameters:
owner - internal name of the enclosing class
name - the name of the method that contains the class
desc - the descriptor of the method

visitSource

public void visitSource(java.lang.String source,
                        java.lang.String debug)
Visits the source of the class

Specified by:
visitSource in interface org.objectweb.asm.ClassVisitor
Parameters:
source - the name of the source file
debug - additional debug information

visitEnd

public void visitEnd()
Visits the end of the class

Specified by:
visitEnd in interface org.objectweb.asm.ClassVisitor