Package org.glassfish.ejb.deployment.descriptor

Examples of org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor


    protected EjbDescriptor createEjbDescriptor(String elementName,
            AnnotationInfo ainfo) throws AnnotationProcessorException {

        AnnotatedElement ae = ainfo.getAnnotatedElement();
        Class ejbClass = (Class)ae;
        EjbSessionDescriptor newDescriptor = new EjbSessionDescriptor();
        newDescriptor.setName(elementName);
        newDescriptor.setEjbClassName(ejbClass.getName());
        newDescriptor.setSessionType(EjbSessionDescriptor.STATEFUL);
        return newDescriptor;
    }
View Full Code Here


     */
    protected HandlerProcessingResult setEjbDescriptorInfo(
            EjbDescriptor ejbDesc, AnnotationInfo ainfo)
            throws AnnotationProcessorException {

        EjbSessionDescriptor ejbSessionDesc = (EjbSessionDescriptor)ejbDesc;

         // set session bean type in case it wasn't set in a sparse ejb-jar.xml.
        if( !ejbSessionDesc.isSessionTypeSet() ) {
            ejbSessionDesc.setSessionType(EjbSessionDescriptor.STATEFUL);
        }


        Stateful sful = (Stateful) ainfo.getAnnotation();
        doDescriptionProcessing(sful.description(), ejbDesc);
        doMappedNameProcessing(sful.mappedName(), ejbDesc);
        // set passivation capable property in case it wasn't set in ejb-jar.xml
        if( !ejbSessionDesc.isPassivationCapableSet()) {
            ejbSessionDesc.setPassivationCapable(sful.passivationCapable());
        }

        return setBusinessAndHomeInterfaces(ejbDesc, ainfo);
    }
View Full Code Here

   
    protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
            EjbContext[] ejbContexts) throws AnnotationProcessorException {
       
        for (EjbContext ejbContext : ejbContexts) {
            EjbSessionDescriptor ejbDesc =
                    (EjbSessionDescriptor) ejbContext.getDescriptor();

            Method annMethod = (Method) ainfo.getAnnotatedElement();
            checkValid(annMethod);
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Setting AfterBegin method " + annMethod);
            }

            ejbDesc.setAfterBeginMethodIfNotSet(new MethodDescriptor(annMethod));
        }

        return getDefaultProcessedResult();
    }
View Full Code Here

        Init init = (Init) ainfo.getAnnotation();

        for(EjbContext next : ejbContexts) {
           
            EjbSessionDescriptor sessionDescriptor =
                (EjbSessionDescriptor) next.getDescriptor();

            Method m = (Method) ainfo.getAnnotatedElement();

            // Check for matching method on home and/or local home interface.

            int numMatches = 0;

           
            String adaptedCreateMethodName = init.value();

            try {
                if( sessionDescriptor.isRemoteInterfacesSupported() ) {
                    addInitMethod(sessionDescriptor, m,
                                  adaptedCreateMethodName, false);
                    numMatches++;
                }
            } catch(Exception e) {
            }                  

            try {               
                if( sessionDescriptor.isLocalInterfacesSupported() ) {
                    addInitMethod(sessionDescriptor, m,
                                  adaptedCreateMethodName, true);
                    numMatches++;
                }
            } catch(Exception e) {               
            }

            if( numMatches == 0 ) {
                log(Level.SEVERE, ainfo,
                    localStrings.getLocalString(
                    "enterprise.deployment.annotation.handlers.notmatchcreate",
                    "Unable to find matching Home create method for Init method {0} on bean {1}.",
                    new Object[] { m, sessionDescriptor.getName() }));
                return getDefaultFailedResult();
            }
        }

        return getDefaultProcessedResult();
View Full Code Here

        AccessTimeout timeout = (AccessTimeout) ainfo.getAnnotation();

        for (EjbContext ejbContext : ejbContexts) {
            if (ejbContext.getDescriptor() instanceof EjbSessionDescriptor) {

                EjbSessionDescriptor sessionDesc =
                        (EjbSessionDescriptor) ejbContext.getDescriptor();

                if( sessionDesc.isStateless() ) {
                    continue;
                }

                if (ElementType.TYPE.equals(ainfo.getElementType())) {
                    // Delay processing Class-level default until after methods are processed
                    ejbContext.addPostProcessInfo(ainfo, this);
                } else {
                    Method annMethod = (Method) ainfo.getAnnotatedElement();

                    // Only assign access timeout info if the method hasn't already
                    // been processed.  This correctly ignores superclass methods that
                    // are overridden and applies the correct .xml overriding semantics.
                    if(!matchesExistingAccessTimeoutMethod(annMethod, sessionDesc)) {
                     
                        MethodDescriptor newMethodDesc = new MethodDescriptor(annMethod);
                        sessionDesc.addAccessTimeoutMethod(newMethodDesc, timeout.value(),
                                                             timeout.unit());
                    }
                }
            }
        }
View Full Code Here

     * Set the default value (from class type annotation) on all
     * methods that don't have a value.
     */
    public void postProcessAnnotation(AnnotationInfo ainfo, EjbContext ejbContext)
            throws AnnotationProcessorException {
        EjbSessionDescriptor ejbDesc = (EjbSessionDescriptor) ejbContext.getDescriptor();

        // At this point, all method-level specific annotations have been processed.
        // For non-private methods, find the ones from the EjbContext's
        // component definition view that are declared on this class.  This will correctly
        // eliminate any overridden methods and provide the most-derived version of each.
        // Use the Class's declared methods list to get the private methods.
       
        Class classAn = (Class)ainfo.getAnnotatedElement();
        AccessTimeout timeoutAnn = (AccessTimeout) ainfo.getAnnotation();

        List<Method> toProcess = new ArrayList<Method>();
        for(Method m : ejbContext.getComponentDefinitionMethods()) {
            if( classAn.equals(m.getDeclaringClass())) {
                toProcess.add(m);
            }
        }
        for(Method m : classAn.getDeclaredMethods()) {
            if( Modifier.isPrivate(m.getModifiers()) ) {
                toProcess.add(m);
            }
        }

        for( Method m : toProcess ) {

            // If the method is declared on the same class as the TYPE-level default
            // and it hasn't already been assigned lock information from the deployment
            // descriptor, set it.
            if( !matchesExistingAccessTimeoutMethod(m, ejbDesc) ) {

                MethodDescriptor newMethodDesc = new MethodDescriptor(m);
                    ejbDesc.addAccessTimeoutMethod(newMethodDesc, timeoutAnn.value(),
                                                   timeoutAnn.unit());
            }
        }

    }
View Full Code Here

    protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
            EjbContext[] ejbContexts) throws AnnotationProcessorException {

        for(EjbContext next : ejbContexts) {
           
            EjbSessionDescriptor ejbSessionDescriptor =
                (EjbSessionDescriptor) next.getDescriptor();

            ejbSessionDescriptor.addPrePassivateDescriptor(
                getPrePassivateDescriptor(ainfo));
           
        }
       
        return getDefaultProcessedResult();
View Full Code Here

    }

    @Override
    public EjbSessionDescriptor getEjbDescriptor() {
        if (descriptor == null) {
            descriptor = new EjbSessionDescriptor();
            descriptor.setEjbBundleDescriptor((EjbBundleDescriptorImpl) getParentNode().getDescriptor());
        }
        return descriptor;
    }
View Full Code Here

        this.initializeInOrder = initializeInOrder;
    }

    void addSingletonContainer(EjbApplication ejbApp, AbstractSingletonContainer c) {
        c.setSingletonLifeCycleManager(this);
        EjbSessionDescriptor sdesc = (EjbSessionDescriptor) c.getEjbDescriptor();
        String src = normalizeSingletonName(sdesc.getName(), sdesc);
       
        String[] depends = sdesc.getDependsOn();
        String[] newDepends = new String[depends.length];

        StringBuilder sb = new StringBuilder("Partial order of dependent(s). "  + src + " => {");
        for(int i=0; i < depends.length; i++) {
            newDepends[i] = normalizeSingletonName(depends[i], sdesc);
View Full Code Here

    void doStartup(EjbApplication ejbApp) {
        Collection<EjbDescriptor> ejbs = ejbApp.getEjbBundleDescriptor().getEjbs();

        for (EjbDescriptor desc : ejbs) {
            if (desc instanceof EjbSessionDescriptor) {
                EjbSessionDescriptor sdesc = (EjbSessionDescriptor) desc;
                if ((sdesc.isSingleton())) {
                    if (sdesc.getInitOnStartup()) {
                        String normalizedSingletonName = normalizeSingletonName(sdesc.getName(), sdesc);
                        initializeSingleton(name2Container.get(normalizedSingletonName));
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor

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.