Package kilim.tools

Class Kilim


  • public class Kilim
    extends java.lang.Object
    runtime weaver This class dynamically weaves kilim-related classes and runs "class". Invoke as java kilim.tools.Kilim class args... if -Dkilim.class.path="classDir1:classDir2:jar1.jar:..." is supplied then runtime weaving will be limited to those paths otherwise, everything on the classpath will be analyzed and woven if needed a main method can also call the trampoline to trigger automatic weaving if needed
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Kilim.Config  
    • Constructor Summary

      Constructors 
      Constructor Description
      Kilim()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isWoven​(java.lang.Class klass)
      has klass been woven
      static void main​(java.lang.String[] args)  
      private static java.lang.String[] processArgs​(java.lang.String[] args)  
      static void run​(java.lang.String className, java.lang.String method, java.lang.String... args)
      run static method className.method(args) using reflection and the WeavingClassLoader
      static boolean trampoline​(boolean check, java.lang.String... args)
      run the calling (static) method in the WeavingClassLoader context intended to be used from main
      static boolean trampoline​(java.lang.Object example, boolean check, java.lang.String... args)
      run the calling (static) method in the WeavingClassLoader context using the classloader that was used to load example intended to be used from main
      static boolean trampoline​(Kilim.Config config, java.lang.String... args)
      run the calling (static) method in the WeavingClassLoader context using the provided config
      private static void usage()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Kilim

        public Kilim()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • run

        public static void run​(java.lang.String className,
                               java.lang.String method,
                               java.lang.String... args)
                        throws java.lang.Exception
        run static method className.method(args) using reflection and the WeavingClassLoader
        Throws:
        java.lang.Exception
      • trampoline

        public static boolean trampoline​(boolean check,
                                         java.lang.String... args)
        run the calling (static) method in the WeavingClassLoader context intended to be used from main
        Parameters:
        check - if the class is already woven then just return
        args - to be passed to the target method
        Returns:
        true if the trampoline was called and returned
        Throws:
        java.lang.RuntimeException - (wrapping for checked) Exceptions from the method call
        java.lang.SecurityException - cascaded from Class.getField
      • trampoline

        public static boolean trampoline​(java.lang.Object example,
                                         boolean check,
                                         java.lang.String... args)
        run the calling (static) method in the WeavingClassLoader context using the classloader that was used to load example intended to be used from main
        Parameters:
        example - an object or a Class that has been loaded by the desired classloader
        check - if the class is already woven then just return
        args - to be passed to the target method
        Returns:
        true if the trampoline was called and returned
        Throws:
        java.lang.RuntimeException - (wrapping for checked) Exceptions from the method call
        java.lang.SecurityException - cascaded from Class.getField
      • trampoline

        public static boolean trampoline​(Kilim.Config config,
                                         java.lang.String... args)
        run the calling (static) method in the WeavingClassLoader context using the provided config
        Parameters:
        config - the config
        args - the args to pass to the method
        Returns:
        true if the trampoline was called and returned
      • isWoven

        public static boolean isWoven​(java.lang.Class klass)
        has klass been woven
        Parameters:
        klass - the class to check
        Returns:
        true if it has been woven
        Throws:
        java.lang.SecurityException - cascaded from Class.getField
      • usage

        private static void usage()
      • processArgs

        private static java.lang.String[] processArgs​(java.lang.String[] args)