Package org.codehaus.aspectwerkz.transform

Examples of org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor




        // emulate the weaving, which should preserve annotations even if methods are wrapped

        AspectWerkzPreProcessor awpp = new AspectWerkzPreProcessor();

        awpp.initialize(null);

        byte[] weaved = awpp.preProcess("test.annotation.AnnotationTest", bytes, classLoader);



        // do a visit
View Full Code Here




    public static void hotswap(String classPattern) {

        AspectWerkzPreProcessor awpp = (AspectWerkzPreProcessor) ClassPreProcessorHelper

                .getClassPreProcessor();

        for (Iterator it = awpp.getClassCacheTuples().iterator(); it.hasNext();) {

            ClassCacheTuple tuple = (ClassCacheTuple) it.next();

            if (tuple.getClassName().startsWith(classPattern)) {
View Full Code Here

            os.write(b);
        }
        byte[] bytes = os.toByteArray();

        // emulate the weaving, which should preserve annotations even if methods are wrapped
        AspectWerkzPreProcessor awpp = new AspectWerkzPreProcessor();
        awpp.initialize();
        byte[] weaved = awpp.preProcess("test.annotation.AnnotationTest", bytes, classLoader);

        // do a visit
        List annotations = new ArrayList();
        ClassReader asmReader = new ClassReader(weaved);
        asmReader.accept(
View Full Code Here



    public void testLineNumbers() throws Throwable {

        AspectWerkzPreProcessor aw = new AspectWerkzPreProcessor();

        aw.initialize();

        String name = LineNumberTest.class.getName().replace('/', '.');

        InputStream in = LineNumberTest.class.getClassLoader().getResourceAsStream(name.replace('.','/')+".class");

        ByteArrayOutputStream bos = new ByteArrayOutputStream();

        byte[] buffer = new byte[1024];

        while (in.available() > 0) {

            int length = in.read(buffer);

            if (length == -1) {

                break;

            }

            bos.write(buffer, 0, length);

        }

        in.close();



        byte[] inBytes = bos.toByteArray();

        AspectWerkzPreProcessor.Output output = aw.preProcessWithOutput(name, inBytes, LineNumberTest.class.getClassLoader());



        // we have 11 joinpoints
View Full Code Here

        }
    }


    public void testLineNumbers() throws Throwable {
        AspectWerkzPreProcessor aw = new AspectWerkzPreProcessor();
        aw.initialize();
        String name = LineNumberTest.class.getName().replace('/', '.');
        InputStream in = LineNumberTest.class.getClassLoader().getResourceAsStream(name.replace('.','/')+".class");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        while (in.available() > 0) {
            int length = in.read(buffer);
            if (length == -1) {
                break;
            }
            bos.write(buffer, 0, length);
        }
        in.close();

        byte[] inBytes = bos.toByteArray();
        AspectWerkzPreProcessor.Output output = aw.preProcessWithOutput(name, inBytes, LineNumberTest.class.getClassLoader());

        // we have 11 joinpoints
        assertEquals(11, output.emittedJoinPoints.length);

        //Note: this test depends upon visitor order
View Full Code Here

    public static void deactivateTrace(String pointcutName) {
        deactivate("eworld/wlw/aop", "examples.logging.LoggingAspect", "logMethod", pointcutName);
    }

    public static void hotswap(String classPattern) {
        AspectWerkzPreProcessor awpp = (AspectWerkzPreProcessor)ClassPreProcessorHelper.getClassPreProcessor();
        for (Iterator it = awpp.getClassCacheTuples().iterator(); it.hasNext();) {
            ClassCacheTuple tuple = (ClassCacheTuple)it.next();
            if (tuple.getClassName().startsWith(classPattern)) {
                try {
                    System.out.println("hotswap " + tuple.getClassName());
                    HotSwapClient.hotswap(tuple.getClassLoader().loadClass(tuple.getClassName()));
View Full Code Here

        // hotswap if needed
        if (activate) {
            //TODO find a better way to trigger that
            // the singleton idea of AWPP is boring
            AspectWerkzPreProcessor awpp = (AspectWerkzPreProcessor)ClassPreProcessorHelper.getClassPreProcessor();
            for (Iterator it = awpp.getClassCacheTuples().iterator(); it.hasNext();) {
                ClassCacheTuple tuple = (ClassCacheTuple)it.next();
                if (isChildOfOrEqual(tuple.getClassLoader(), loader)) {
                    try {
                        System.out.println("hotswapping " + tuple.getClassName());
View Full Code Here

            os.write(b);
        }
        byte[] bytes = os.toByteArray();

        // emulate the weaving, which should preserve annotations even if methods are wrapped
        AspectWerkzPreProcessor awpp = new AspectWerkzPreProcessor();
        awpp.initialize(null);
        byte[] weaved = awpp.preProcess("test.annotation.AnnotationTest", bytes, classLoader);

        // do a visit
        List annotations = new ArrayList();
        ClassReader asmReader = new ClassReader(weaved);
        asmReader.accept(
View Full Code Here

    public static void deactivateTrace(String pointcutName) {
        deactivate("eworld/wlw/aop", "examples.logging.LoggingAspect", "logMethod", pointcutName);
    }

    public static void hotswap(String classPattern) {
        AspectWerkzPreProcessor awpp = (AspectWerkzPreProcessor) ClassPreProcessorHelper
                .getClassPreProcessor();
        for (Iterator it = awpp.getClassCacheTuples().iterator(); it.hasNext();) {
            ClassCacheTuple tuple = (ClassCacheTuple) it.next();
            if (tuple.getClassName().startsWith(classPattern)) {
                try {
                    System.out.println("hotswap " + tuple.getClassName());
                    HotSwapClient.hotswap(tuple.getClassLoader().loadClass(tuple.getClassName()));
View Full Code Here

        // hotswap if needed
        if (activate) {
            //TODO find a better way to trigger that
            // the singleton idea of AWPP is boring
            AspectWerkzPreProcessor awpp = (AspectWerkzPreProcessor) ClassPreProcessorHelper.getClassPreProcessor();
            for (Iterator it = awpp.getClassCacheTuples().iterator(); it.hasNext();) {
                ClassCacheTuple tuple = (ClassCacheTuple) it.next();
                if (isChildOfOrEqual(tuple.getClassLoader(), loader)) {
                    try {
                        System.out.println("hotswapping " + tuple.getClassName());
View Full Code Here

TOP

Related Classes of org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor

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.