Package org.ow2.asm.attrs

Examples of org.ow2.asm.attrs.Comment


    public void testIllegalFieldMemberVisitAfterEnd() {
        FieldVisitor fv = new CheckFieldAdapter(new EmptyVisitor());
        fv.visitEnd();
        try {
            fv.visitAttribute(new Comment());
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here


    public void testIllegalMethodMemberVisitAfterEnd() {
        MethodVisitor mv = new CheckMethodAdapter(new EmptyVisitor());
        mv.visitEnd();
        try {
            mv.visitAttribute(new Comment());
            fail();
        } catch (Exception e) {
        }
    }
View Full Code Here

        }

        StringWriter sw = new StringWriter();
        GASMifierClassVisitor cv = new GASMifierClassVisitor(new PrintWriter(sw));
        cr.accept(cv,
                new Attribute[] { new Comment(), new CodeComment() },
                ClassReader.EXPAND_FRAMES);

        String generated = sw.toString();

        byte[] generatorClassData;
        try {
            generatorClassData = COMPILER.compile(n, generated);
        } catch (Exception ex) {
            trace(generated);
            throw ex;
        }

        ClassWriter cw = new ClassWriter(0);
        cr.accept(new ClassAdapter(cw) {
            @Override
            public MethodVisitor visitMethod(
                final int access,
                final String name,
                final String desc,
                final String signature,
                final String[] exceptions)
            {
                return new LocalVariablesSorter(access,
                        desc,
                        super.visitMethod(access,
                                name,
                                desc,
                                signature,
                                exceptions));
            }
        },
                new Attribute[] { new Comment(), new CodeComment() },
                ClassReader.EXPAND_FRAMES);
        cr = new ClassReader(cw.toByteArray());

        String nd = n + "Dump";
        if (n.indexOf('.') != -1) {
View Full Code Here

                "pkg/Attribute",
                null,
                "java/lang/Object",
                null);

        cw.visitAttribute(new Comment());

        fv = cw.visitField(ACC_PUBLIC, "f", "I", null, null);
        fv.visitAttribute(new Comment());
        fv.visitEnd();

        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitAttribute(new Comment());
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");

        /*
 
View Full Code Here

    public void test() throws Exception {
        ClassReader cr = new ClassReader(is);
        ClassWriter cw = new ClassWriter(0);
        ClassVisitor cv = new TraceClassVisitor(cw,
                new PrintWriter(new CharArrayWriter()));
        cr.accept(cv, new Attribute[] { new Comment(), new CodeComment() }, 0);
        assertEquals(cr, new ClassReader(cw.toByteArray()));
    }
View Full Code Here

            return;
        }

        StringWriter sw = new StringWriter();
        ASMifierClassVisitor cv = new ASMifierClassVisitor(new PrintWriter(sw));
        cr.accept(cv, new Attribute[] { new Comment(), new CodeComment() }, 0);

        String generated = sw.toString();

        byte[] generatorClassData;
        try {
View Full Code Here

            } catch (Exception e) {
                this.logger.error("Cannot configure Carol to use CMI", e);
                throw new EZBComponentException("Cannot configure Carol to use CMI", e);
            }

            ClusterViewManagerFactory clusterViewManagerFactory = ClusterViewManagerFactory.getFactory();

            // Start the manager
            try {
                this.clusterViewManager = (ServerClusterViewManager) clusterViewManagerFactory.create();
            } catch (Exception e) {
                this.logger.error("Cannot retrieve the CMI Server", e);
                throw new EZBComponentException("Cannot retrieve the CMI Server", e);
            }
            if (this.clusterViewManager != null
                    && this.clusterViewManager.getState().equals(ClusterViewManager.State.STOPPED)) {
                if (this.eventComponent != null) {
                    List<Component> components =
                        clusterViewManagerFactory.getConfig().getComponents().getComponents();
                    if (components != null) {
                        for (Component cmiEventComponent : components) {
                            if (org.ow2.cmi.component.event.EventComponent.class.isAssignableFrom(cmiEventComponent.getClass())) {
                                ((org.ow2.cmi.component.event.EventComponent) cmiEventComponent).setEventService(
                                        this.eventComponent.getEventService());
View Full Code Here

            return EASYBEANS_ROOT;
        } else if (EZBContainer.class.isAssignableFrom(clazz)) {
            // The object is an EJB container.

            EZBContainer container = (EZBContainer) instance;

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Compute the application id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName;
        } else if (Factory.class.isAssignableFrom(clazz)) {
            // The object is a bean factory.

            Factory<?, ?> factory = (Factory<?, ?>) instance;
            EZBContainer container = factory.getContainer();

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Get the bean class name (remove all character before the last point).
            String factoryName = factory.getClassName().replaceAll("(.*\\.)", "");

            // Compute the bean id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName + "/" + factoryName;
        } else {
            throw new java.lang.IllegalArgumentException("Name is not define for argument of type " + instance.getClass());
        }
    }
View Full Code Here

                    throw new EZBComponentException("Cannot start the CMI Server", e);
                }
            }
        }
        // register the listener.
        EZBEventListener eventListener = new CmiEventListener();
        this.eventComponent.registerEventListener(eventListener);

        this.logger.debug("The CMI configuration extension has been added.");
    }
View Full Code Here

            public synchronized void handle(final IEvent event) {
                if (EZBEventBeanInvocationBegin.class.isAssignableFrom(event.getClass())) {
                    EZBEventBeanInvocationBegin e = (EZBEventBeanInvocationBegin) event;
                    MeanCallTimeStatistic.this.pendingCall.put(Long.valueOf(e.getInvocationNumber()), e);
                } else {
                    EZBEventBeanInvocation eventEnd = (EZBEventBeanInvocation) event;
                    EZBEventBeanInvocation eventBegin =
                        MeanCallTimeStatistic.this.pendingCall.remove(Long.valueOf(eventEnd.getInvocationNumber()));

                    MeanCallTimeStatistic.this.count++;
                    MeanCallTimeStatistic.this.total += eventEnd.getTime() - eventBegin.getTime();
                    setLastSampleTime(System.currentTimeMillis());
                }
            }
View Full Code Here

TOP

Related Classes of org.ow2.asm.attrs.Comment

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.