Package org.apache.openejb

Examples of org.apache.openejb.InterfaceType


        this.interfaceType = interfaceType;
        this.primaryKey = pk;
        this.setDeploymentInfo((CoreDeploymentInfo) deploymentInfo);

        if (interfaces == null || interfaces.size() == 0) {
            InterfaceType objectInterfaceType = (interfaceType.isHome()) ? interfaceType.getCounterpart() : interfaceType;
            interfaces = new ArrayList<Class>(deploymentInfo.getInterfaces(objectInterfaceType));
        }

        this.doIntraVmCopy = !interfaceType.isLocal();
View Full Code Here


            }
        }
    }

    public InterfaceType getInterfaceType(Class clazz) {
        InterfaceType type = interfaces.get(clazz);
        if (type != null) return type;

        if (javax.ejb.EJBLocalHome.class.isAssignableFrom(clazz)) return InterfaceType.EJB_LOCAL_HOME;
        if (javax.ejb.EJBLocalObject.class.isAssignableFrom(clazz)) return InterfaceType.EJB_LOCAL;
        if (javax.ejb.EJBHome.class.isAssignableFrom(clazz)) return InterfaceType.EJB_HOME;
View Full Code Here

    }

    public Object createProxy(Object primaryKey) {
        try {

            InterfaceType objectInterfaceType = this.interfaceType.getCounterpart();

            EjbObjectProxyHandler handler = newEjbObjectHandler(getDeploymentInfo(), primaryKey, objectInterfaceType, this.getInterfaces());

            List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 1);
View Full Code Here

        ThreadContext callContext = new ThreadContext(deploymentInfo, primKey);
        ThreadContext oldCallContext = ThreadContext.enter(callContext);
        try {
            checkAuthorization(deploymentInfo, callMethod, callInterface);

            InterfaceType type = deploymentInfo.getInterfaceType(callInterface);
            if (type.isComponent() && instanceManager.getBeanTransaction(callContext) != null) {
                throw new ApplicationException(new RemoveException("A stateful EJB enrolled in a transaction can not be removed"));
            }

            Method runMethod = deploymentInfo.getMatchingBeanMethod(callMethod);
            StatefulInstanceManager.Instance instance = (StatefulInstanceManager.Instance) instanceManager.obtainInstance(primKey, callContext);

            if (instance == null) throw new ApplicationException(new javax.ejb.NoSuchEJBException());

            boolean retain = false;
            try {
                callContext.setCurrentAllowedStates(StatefulContext.getStates());
                callContext.setCurrentOperation(Operation.REMOVE);
                callContext.setInvokedInterface(callInterface);

                Class<?> declaringClass = callMethod.getDeclaringClass();
                if (declaringClass.equals(EJBHome.class) || declaringClass.equals(EJBLocalHome.class)){
                    args = new Object[]{}; // no args to pass on home.remove(remote) calls
                }
               
                List<InterceptorData> interceptors = deploymentInfo.getMethodInterceptors(runMethod);
                InterceptorStack interceptorStack = new InterceptorStack(instance.bean, runMethod, Operation.REMOVE, interceptors, instance.interceptors);
                return _invoke(callMethod, interceptorStack, args, instance, callContext);

            } catch(InvalidateReferenceException e){
                throw e;
            } catch(ApplicationException e){
                if (type.isBusiness()){
                    retain = deploymentInfo.retainIfExeption(runMethod);
                    throw e;
                } else {
                    return null;
                }
View Full Code Here

                final BeanContext beanContext = cdiEjbBean.getBeanContext();
                final Provider provider = webBeansContext.getNormalScopeProxyFactory().getInstanceProvider(beanContext.getClassLoader(), cdiEjbBean);

                if (!beanContext.isLocalbean()) {
                    final List<Class> interfaces = new ArrayList<Class>();
                    final InterfaceType type = beanContext.getInterfaceType(interfce);
                    if (type != null) {
                        interfaces.addAll(beanContext.getInterfaces(type));
                    } else { // can happen when looked up from impl instead of API in OWB -> default to business local
                        interfaces.addAll(beanContext.getInterfaces(InterfaceType.BUSINESS_LOCAL));
                    }
View Full Code Here

    }

    public Object createProxy(final Object primaryKey, final Class mainInterface) {
        try {

            final InterfaceType objectInterfaceType = this.interfaceType.getCounterpart();
            final BeanType type = getBeanContext().getComponentType();

            final EjbObjectProxyHandler handler = newEjbObjectHandler(getBeanContext(), primaryKey, objectInterfaceType, getInterfaces(), mainInterface);

            // TODO Is it correct for ManagedBean injection via managed bean class?
View Full Code Here

        this.interfaceType = interfaceType;
        this.primaryKey = pk;
        this.setBeanContext(beanContext);

        if (interfaces == null || interfaces.size() == 0) {
            final InterfaceType objectInterfaceType = interfaceType.isHome() ? interfaceType.getCounterpart() : interfaceType;
            interfaces = new ArrayList<Class>(beanContext.getInterfaces(objectInterfaceType));
        }

        if (mainInterface == null && interfaces.size() == 1) {
            mainInterface = interfaces.get(0);
View Full Code Here

        }

        final ThreadContext threadContext = ThreadContext.getThreadContext();
        final BeanContext di = threadContext.getBeanContext();

        final InterfaceType interfaceType = di.getInterfaceType(interfce);
        final BeanType type = di.getComponentType();

        if (interfaceType == null) {
            throw new IllegalStateException("Component has no such interface: " + interfce.getName());
        }

        if (!interfaceType.isBusiness()) {
            throw new IllegalStateException("Interface is not a business interface for this bean: " + interfce.getName());
        }

        try {
            final EjbObjectProxyHandler handler;
View Full Code Here

    public Class getInvokedBusinessInterface() {
        check(Call.getInvokedBusinessInterface);
        final ThreadContext threadContext = ThreadContext.getThreadContext();
        final Class invokedInterface = threadContext.getInvokedInterface();
        final InterfaceType type = threadContext.getBeanContext().getInterfaceType(invokedInterface);
        if (!type.isBusiness()) {
            throw new IllegalStateException("The EJB spec requires us to cripple the use of this method for anything but business interface proxy.  But FYI, your invoked interface is: " + invokedInterface.getName());
        }

        if (invokedInterface == null) {
            throw new IllegalStateException("Business interface not set into ThreadContext.");
View Full Code Here

            if (obj instanceof Proxy) {
                obj = convertEJBToCORBAObject((Proxy) obj);
            }
            if (obj instanceof StandardServant) {
                StandardServant servant = (StandardServant) obj;
                InterfaceType servantType = servant.getInterfaceType();
                String deploymentId = servant.getEjbDeployment().getDeploymentId();
                try {
                    RefGenerator refGenerator = AdapterWrapper.getRefGenerator(deploymentId);
                    if (refGenerator == null) {
                        throw new MARSHAL("Could not find RefGenerator for deployment id: " + deploymentId);
View Full Code Here

TOP

Related Classes of org.apache.openejb.InterfaceType

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.