Package org.ow2.easybeans.api

Examples of org.ow2.easybeans.api.EZBContainer


        // Get the EasyBeans embedded instance
        EZBServer embedded = EmbeddedManager.getEmbedded(easyBeansServerID);

        // Get the container object
        EZBContainer container = embedded.getContainer(containerID);
        // get the factory
        Factory<?, ?> factory = container.getFactory(factoryName);

        // Ensure operation state is valid
        OperationState operationState = factory.getOperationState();
        if (DEPENDENCY_INJECTION == operationState || LIFECYCLE_CALLBACK_INTERCEPTOR == operationState
                || AFTER_COMPLETION == operationState) {
View Full Code Here


        if (server == null) {
            throw new JobExecutionException("Cannot find the embedded server with the id '" + data.getEasyBeansServerID() + "'.");
        }

        // Get the container
        EZBContainer container = server.getContainer(data.getContainerId());
        if (container == null) {
            throw new JobExecutionException("Cannot find the container with the id '" + data.getContainerId() + "'.");
        }

        // Get the factory
        Factory factory = container.getFactory(data.getFactoryName());
        if (factory == null) {
            throw new JobExecutionException("Cannot find the factory with the name '" + data.getFactoryName() + "'.");
        }

        // Get the timer
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    public static <T> T getProxy(final Factory<?, ?> factory, final Class<T> interfaceClass, final boolean isLocalProxy) {

        // Get elements used to create a proxy
        EZBContainer container = factory.getContainer();
        EZBServer server = container.getConfiguration().getEZBServer();
        String containerID = container.getId();
        String factoryName = factory.getBeanInfo().getName();

        // If factory is a stateful factory, add the stateful flag
        boolean isStateful = false;
        if (factory instanceof StatefulSessionFactory) {
View Full Code Here

     *         null if error
     */
    protected IArchive removeArchiveIfDeployed(final File file) {
        IArchive archive = ArchiveManager.getInstance().getArchive(file);
        if (archive != null) {
            EZBContainer container = this.server.findContainer(archive);
            if (container != null) {
                this.server.removeContainer(container);
            }
        }
        return archive;
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

             * Handle the event.
             * @param event The event to handle.
             */
            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()));

View Full Code Here

     * @param methodVisitor the given visitor on which annotation are replayed.
     */
    @Override
    public void replay(final MethodVisitor methodVisitor) {
        // Build a new annotation visitor for the given method
        AnnotationVisitor annotationVisitor = methodVisitor.visitParameterAnnotation(this.index, getName(), getVisible());
        getLogger().debug("AnnotationVisitor annotationVisitor = methodVisitor.visitParameterAnnotation({0}, {1}, {2});",
                Integer.valueOf(this.index), getName(), Boolean.valueOf(getVisible()));

        // Replay
        replayInner(annotationVisitor);

        // End of visit
        annotationVisitor.visitEnd();
        getLogger().debug("annotationVisitor.visitEnd();");
    }
View Full Code Here

        //        }
        if (this.classAnnotationMetadata.isBean()) {
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansInvocationContextFactory",
            "()Lorg/ow2/easybeans/api/interceptor/EZBInvocationContextFactory;");
            Label l1 = new Label();
            mv.visitJumpInsn(IFNULL, l1);

            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansInvocationContextFactory", "()Lorg/ow2/easybeans/api/interceptor/EZBInvocationContextFactory;");
View Full Code Here

        int access = ACC_PUBLIC;
        if (this.staticMode) {
            access = access + ACC_STATIC;
        }

        MethodVisitor mv = this.cv.visitMethod(access, INJECTED_METHOD, "()V", null,
                new String[] {"org/ow2/easybeans/api/injection/EasyBeansInjectionException"});
        // Add some flags on the generated method
        CommonClassGenerator.addAnnotationsOnGeneratedMethod(mv);

        mv.visitCode();

        // Init the dynamic interceptor manager if there is an invocation
        // context factory
        //        if (getEasyBeansInvocationContextFactory() != null) {
        //            this.easyBeansDynamicInterceptorManager = getEasyBeansInvocationContextFactory().getInterceptorManagerFactory().getInterceptorManager();
        //            this.easyBeansDynamicInterceptorManager.setEasyBeansContext(getEasyBeansContext());
        //            this.easyBeansDynamicInterceptorManager.injectedByEasyBeans();
        //        }
        if (this.classAnnotationMetadata.isBean()) {
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansInvocationContextFactory",
            "()Lorg/ow2/easybeans/api/interceptor/EZBInvocationContextFactory;");
            Label l1 = new Label();
            mv.visitJumpInsn(IFNULL, l1);

            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansInvocationContextFactory", "()Lorg/ow2/easybeans/api/interceptor/EZBInvocationContextFactory;");
            mv.visitMethodInsn(INVOKEINTERFACE, "org/ow2/easybeans/api/interceptor/EZBInvocationContextFactory", "getInterceptorManagerFactory", "()Lorg/ow2/easybeans/api/interceptor/EZBInterceptorManagerFactory;");
            mv.visitMethodInsn(INVOKEINTERFACE, "org/ow2/easybeans/api/interceptor/EZBInterceptorManagerFactory", "getInterceptorManager", "()Lorg/ow2/easybeans/api/interceptor/EZBInterceptorManager;");
            mv.visitFieldInsn(PUTFIELD, this.classAnnotationMetadata.getClassName(), "easyBeansDynamicInterceptorManager", "Lorg/ow2/easybeans/api/interceptor/EZBInterceptorManager;");

            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.classAnnotationMetadata.getClassName(), "easyBeansDynamicInterceptorManager", "Lorg/ow2/easybeans/api/interceptor/EZBInterceptorManager;");
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, this.classAnnotationMetadata.getClassName(), "getEasyBeansContext", "()Lorg/ow2/easybeans/api/container/EZBEJBContext;");
            mv.visitMethodInsn(INVOKEINTERFACE, "org/ow2/easybeans/api/interceptor/EZBInterceptorManager", "setEasyBeansContext", "(Lorg/ow2/easybeans/api/container/EZBEJBContext;)V");
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.classAnnotationMetadata.getClassName(), "easyBeansDynamicInterceptorManager", "Lorg/ow2/easybeans/api/interceptor/EZBInterceptorManager;");
            mv.visitMethodInsn(INVOKEINTERFACE, "org/ow2/easybeans/api/interceptor/EZBInterceptorManager", "injectedByEasyBeans", "()V");
            mv.visitLabel(l1);
        }



        // First, call the super class method (if the super class has been
        // analyzed) and if there is one
        String superNameClass = this.classAnnotationMetadata.getSuperName();
        if (superNameClass != null && !superNameClass.equals(JAVA_LANG_OBJECT)) {
            EasyBeansEjbJarClassMetadata superMetadata = this.classAnnotationMetadata.getLinkedClassMetadata(superNameClass);
            if (superMetadata != null) {
                if (!this.staticMode) {
                    // generate call to super method : super.INJECTED_METHOD();
                    mv.visitVarInsn(ALOAD, 0);
                    mv.visitMethodInsn(INVOKESPECIAL, superMetadata.getClassName(), INJECTED_METHOD, "()V");
                } else {
                    mv.visitMethodInsn(INVOKESTATIC, superMetadata.getClassName(), INJECTED_METHOD, "()V");
                }
            }
        }



        // If it is a bean, call the interceptorManager and the attributes (like context and factory)
        if (this.classAnnotationMetadata.isBean()) {
            String clNameManager = this.classAnnotationMetadata.getClassName()
            + EasyBeansInvocationContextGenerator.SUFFIX_INTERCEPTOR_MANAGER;

            // this.interceptorManager.setEasyBeansContext(easyBeansContext);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.classAnnotationMetadata.getClassName(), "easyBeansInterceptorManager", "L"
                    + clNameManager + ";");
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.classAnnotationMetadata.getClassName(), "easyBeansContext", EZB_EJBCONTEXT_DESC);
            mv.visitMethodInsn(INVOKEVIRTUAL, clNameManager, "setEasyBeansContext", "(" + EZB_EJBCONTEXT_DESC + ")V");


            // this.interceptorManager.injectedByEasyBeans();
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, this.classAnnotationMetadata.getClassName(), "easyBeansInterceptorManager", "L"
                    + clNameManager + ";");
            mv.visitMethodInsn(INVOKEVIRTUAL, clNameManager, "injectedByEasyBeans", "()V");

        }

        generateBodyInjectedMethod(mv);

        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
        mv.visitEnd();
    }
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.api.EZBContainer

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.