Package org.apache.openejb.assembler.classic

Examples of org.apache.openejb.assembler.classic.EnterpriseBeanInfo


    private CmrFieldInfo initRelationshipRole(EjbRelationshipRole role, EjbRelationshipRole relatedRole, Map<String, EnterpriseBeanInfo> infos) throws OpenEJBException {
        CmrFieldInfo cmrFieldInfo = new CmrFieldInfo();

        // find the entityBeanInfo info for this role
        String ejbName = role.getRelationshipRoleSource().getEjbName();
        EnterpriseBeanInfo enterpriseBeanInfo = infos.get(ejbName);
        if (enterpriseBeanInfo == null) {
            throw new OpenEJBException("Relation role source ejb not found " + ejbName);
        }
        if (!(enterpriseBeanInfo instanceof EntityBeanInfo)) {
            throw new OpenEJBException("Relation role source ejb is not an entity bean " + ejbName);
        }
        EntityBeanInfo entityBeanInfo = (EntityBeanInfo) enterpriseBeanInfo;
        cmrFieldInfo.roleSource = entityBeanInfo;

        // RoleName: this may be null
        cmrFieldInfo.roleName = role.getEjbRelationshipRoleName();

        cmrFieldInfo.synthetic = role.getCmrField() == null;

        // CmrFieldName: is null for uni-directional relationships
        if (role.getCmrField() != null) {
            cmrFieldInfo.fieldName = role.getCmrField().getCmrFieldName();
            // CollectionType: java.util.Collection or java.util.Set
            if (role.getCmrField().getCmrFieldType() != null) {
                cmrFieldInfo.fieldType = role.getCmrField().getCmrFieldType().toString();
            }
        } else {
            String relatedEjbName = relatedRole.getRelationshipRoleSource().getEjbName();
            EnterpriseBeanInfo relatedEjb = infos.get(relatedEjbName);
            if (relatedEjb == null) {
                throw new OpenEJBException("Relation role source ejb not found " + relatedEjbName);
            }
            if (!(relatedEjb instanceof EntityBeanInfo)) {
                throw new OpenEJBException("Relation role source ejb is not an entity bean " + relatedEjbName);
View Full Code Here


        }
        return methodInfo;
    }

    private EnterpriseBeanInfo initSessionBean(SessionBean s, Map m) throws OpenEJBException {
        EnterpriseBeanInfo bean = null;

        if (s.getSessionType() == SessionType.STATEFUL) {
            bean = new StatefulBeanInfo();
            StatefulBeanInfo stateful = ((StatefulBeanInfo) bean);
View Full Code Here

        for (EjbRef ejb : ejbRefs) {
            if (ejb.getRefType() != EjbRef.Type.UNKNOWN) continue;

            String interfce = ejb.getRemote();

            EnterpriseBeanInfo otherBean = null;
            if (ejb.getEjbLink() != null) {
                String deploymentId = ejbLinkResolver.resolveLink(ejb.getEjbLink(), moduleId);
                if (deploymentId != null) {
                    otherBean = allDeployments.get(deploymentId);
                }
View Full Code Here

        EjbJar ejbJar = new EjbJar();
        ejbJar.addEnterpriseBean(new StatelessBean(WidgetBean.class));

        EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);

        EnterpriseBeanInfo beanInfo = ejbJarInfo.enterpriseBeans.get(0);

        Map<String, ResourceReferenceInfo> refs = new HashMap<String,ResourceReferenceInfo>();
        for (ResourceReferenceInfo ref : beanInfo.jndiEnc.resourceRefs) {
            refs.put(ref.referenceName.replaceAll(".*/",""), ref);
        }
View Full Code Here

        ejbJar.properties.putAll(jar.getProperties());
        ejbJar.properties.putAll(jar.getOpenejbJar().getProperties());

        for (final EnterpriseBean bean : jar.getEjbJar().getEnterpriseBeans()) {
            final EnterpriseBeanInfo beanInfo;
            if (bean instanceof SessionBean) {
                beanInfo = initSessionBean((SessionBean) bean, ejbJar, ejbds);
            } else if (bean instanceof EntityBean) {
                beanInfo = initEntityBean((EntityBean) bean, ejbds);
            } else if (bean instanceof MessageDrivenBean) {
View Full Code Here

    private CmrFieldInfo initRelationshipRole(final EjbRelationshipRole role, final EjbRelationshipRole relatedRole, final Map<String, EnterpriseBeanInfo> infos) throws OpenEJBException {
        final CmrFieldInfo cmrFieldInfo = new CmrFieldInfo();

        // find the entityBeanInfo info for this role
        final String ejbName = role.getRelationshipRoleSource().getEjbName();
        final EnterpriseBeanInfo enterpriseBeanInfo = infos.get(ejbName);
        if (enterpriseBeanInfo == null) {
            throw new OpenEJBException("Relation role source ejb not found " + ejbName);
        }
        if (!(enterpriseBeanInfo instanceof EntityBeanInfo)) {
            throw new OpenEJBException("Relation role source ejb is not an entity bean " + ejbName);
        }
        final EntityBeanInfo entityBeanInfo = (EntityBeanInfo) enterpriseBeanInfo;
        cmrFieldInfo.roleSource = entityBeanInfo;

        // RoleName: this may be null
        cmrFieldInfo.roleName = role.getEjbRelationshipRoleName();

        cmrFieldInfo.synthetic = role.getCmrField() == null;

        // CmrFieldName: is null for uni-directional relationships
        if (role.getCmrField() != null) {
            cmrFieldInfo.fieldName = role.getCmrField().getCmrFieldName();
            // CollectionType: java.util.Collection or java.util.Set
            if (role.getCmrField().getCmrFieldType() != null) {
                cmrFieldInfo.fieldType = role.getCmrField().getCmrFieldType().toString();
            }

            if (cmrFieldInfo.fieldType == null && relatedRole.getMultiplicity() == Multiplicity.MANY) {
                cmrFieldInfo.fieldType = Collection.class.getName();
            }
        } else {
            final String relatedEjbName = relatedRole.getRelationshipRoleSource().getEjbName();
            final EnterpriseBeanInfo relatedEjb = infos.get(relatedEjbName);
            if (relatedEjb == null) {
                throw new OpenEJBException("Relation role source ejb not found " + relatedEjbName);
            }
            if (!(relatedEjb instanceof EntityBeanInfo)) {
                throw new OpenEJBException("Relation role source ejb is not an entity bean " + relatedEjbName);
View Full Code Here

        }
        return methodInfo;
    }

    private EnterpriseBeanInfo initSessionBean(final SessionBean s, final EjbJarInfo ejbJar, final Map m) throws OpenEJBException {
        EnterpriseBeanInfo bean = null;

        if (s.getSessionType() == SessionType.STATEFUL) {
            bean = new StatefulBeanInfo();
            final StatefulBeanInfo stateful = (StatefulBeanInfo) bean;
View Full Code Here

        EjbJar ejbJar = new EjbJar();
        StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(SuperBean.class));

        EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);

        EnterpriseBeanInfo beanInfo = ejbJarInfo.enterpriseBeans.get(0);

        assertEquals(asList(Everything.class.getName()), beanInfo.businessLocal);
        assertEquals(asList(Everything.class.getName()), beanInfo.businessRemote);
        assertEquals(Everything.class.getName(), beanInfo.serviceEndpoint);
View Full Code Here

            setUp();
            strict(strict);

            Map<String, EnterpriseBeanInfo> beans = deploy(YellowOneBean.class, YellowTwoBean.class, YellowThreeBean.class, YellowFourBean.class, YellowFiveBean.class, YellowSixBean.class);

            EnterpriseBeanInfo beanInfo;

            beanInfo = beans.get("YellowOneBean");

            assertEquals(list(YellowOneLocal.class), sort(beanInfo.businessLocal));
            assertEquals(list(), sort(beanInfo.businessRemote));
View Full Code Here

        setUp();
        strict(false);

        Map<String, EnterpriseBeanInfo> beans = deploy(LemonOneBean.class, LemonTwoBean.class, LemonThreeBean.class, LemonFourBean.class, LemonFiveBean.class, LemonSixBean.class);

        EnterpriseBeanInfo beanInfo;

        beanInfo = beans.get("LemonOneBean");

        assertEquals(list(YellowOneLocal.class), sort(beanInfo.businessLocal));
        assertEquals(list(), sort(beanInfo.businessRemote));
View Full Code Here

TOP

Related Classes of org.apache.openejb.assembler.classic.EnterpriseBeanInfo

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.