Package org.apache.openejb

Examples of org.apache.openejb.InterfaceType


            ThreadContext threadContext = ThreadContext.getThreadContext();
            DeploymentInfo di = threadContext.getDeploymentInfo();


            InterfaceType interfaceType = di.getInterfaceType(interfce);

            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 {
                EjbObjectProxyHandler handler;
View Full Code Here


        }

        public Class getInvokedBusinessInterface() {
            ThreadContext threadContext = ThreadContext.getThreadContext();
            Class invokedInterface = threadContext.getInvokedInterface();
            InterfaceType type = threadContext.getDeploymentInfo().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.");
            }
            return invokedInterface;
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

    public Object getBusinessObject(Class interfce) {
        ThreadContext threadContext = ThreadContext.getThreadContext();
        DeploymentInfo di = threadContext.getDeploymentInfo();

        InterfaceType interfaceType;
        if (di.getBusinessLocalInterface() != null && di.getBusinessLocalInterface().getName().equals(interfce.getName())) {
            interfaceType = InterfaceType.BUSINESS_LOCAL;
        } else if (di.getBusinessRemoteInterface() != null && di.getBusinessRemoteInterface().getName().equals(interfce.getName())) {
            interfaceType = InterfaceType.BUSINESS_REMOTE;
        } else {
View Full Code Here

    public Object resolve(EJBHomeHandler handler) {
        try {
            EJBMetaDataImpl ejb = handler.getEjb();

            InterfaceType interfaceType = (ejb.getRemoteInterfaceClass() == null)? InterfaceType.BUSINESS_REMOTE_HOME : InterfaceType.EJB_HOME;

            ArrayList<Class> interfaces = new ArrayList<Class>();
            if (interfaceType.isBusiness()){
                interfaces.addAll(ejb.getBusinessClasses());
            } else {
                interfaces.add(ejb.getRemoteInterfaceClass());
            }
View Full Code Here

    public Object resolve(EJBObjectHandler handler) {
        try {
            EJBMetaDataImpl ejb = handler.getEjb();

            InterfaceType interfaceType = (ejb.getRemoteInterfaceClass() == null)? InterfaceType.BUSINESS_REMOTE_HOME : InterfaceType.EJB_HOME;

            ArrayList<Class> interfaces = new ArrayList<Class>();
            if (interfaceType.isBusiness()){
                interfaces.addAll(ejb.getBusinessClasses());
            } else {
                interfaces.add(ejb.getRemoteInterfaceClass());
            }
View Full Code Here

        String jndiName;// get and verify deploymentId
        String deploymentId = getProperty(reference, DEPLOYMENT_ID);
        if (deploymentId == null) throw new NamingException("ejb-ref deploymentId is null");

        // get and verify interface type
        InterfaceType type = InterfaceType.BUSINESS_REMOTE;
        String interfaceType = getProperty(reference, REMOTE);

        if (interfaceType == null) {
            type = InterfaceType.LOCALBEAN;
            interfaceType = getProperty(reference, LOCALBEAN);
View Full Code Here

        if (beanContext == null) {
            String message = messages.format("deploymentNotFound", info.getName(), deploymentId);
            throw new NameNotFoundException(message);
        }

        InterfaceType type = null;
        switch (info.getRefType()){
            case LOCAL: type = InterfaceType.BUSINESS_LOCAL; break;
            case REMOTE: type = InterfaceType.BUSINESS_REMOTE; break;
        }
View Full Code Here

    }

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

            InterfaceType objectInterfaceType = this.interfaceType.getCounterpart();

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

            // TODO Is it correct for ManagedBean injection via managed bean class?
            if ((InterfaceType.LOCALBEAN.equals(objectInterfaceType) || getBeanContext().getComponentType().equals(BeanType.MANAGED))
View Full Code Here

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

        if (interfaces == null || interfaces.size() == 0) {
            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

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.