Package org.apache.beehive.controls.api

Examples of org.apache.beehive.controls.api.ControlException


                //
                // Spring doesn't provide any mechanism to pass dynamic constructor args
                // to Spring bean factory methods.
                //
                if (props != null)
                    throw new ControlException("Providing a PropertyMap to the bean constructor is not supported by SpringControlFactory");
            }
            else
            {
                //
                // Fall back to using standard Java instantation if no Spring configuration
                // could be found.
                // TODO: Have a configuration option where this results in a failure, to avoid
                // masking misconfiguration issues if the expectation is that all usage of
                // Controls is configured via Spring.
                //
                bean = super.instantiate(beanClass, props, context, id);
            }
        }
        catch (Exception e)
        {
            throw new ControlException("Exception creating ControlBean", e);
        }

        return bean;
    }
View Full Code Here


        //
        if (remoteHome != null)
        {
            if (localHome != null)
            {
                throw new ControlException(controlInterface +
                                           " extends multiple EJB home interfaces.");
            }
            _homeInterface = getRoot(remoteHome, derivesFrom);
        }
        else if (localHome != null)
        {
            _homeInterface = getRoot(localHome, derivesFrom);
        }
        else
        {
            throw new ControlException(controlInterface +
                " does not extend the EJBHome or EJBLocalHome interfaces");
        }

        if (remoteBean != null)
        {
            if (localBean != null)
            {
                throw new ControlException("Interface " + controlInterface +
                            " extends multiple EJB object interfaces.");
            }
            _beanInterface = getRoot(remoteBean, derivesFrom);
        }
        else if (localBean != null)
        {
            _beanInterface = getRoot(localBean, derivesFrom);
        }
        else
        {
            throw new ControlException("Interface " + controlInterface +
             " does not extend the EJBObject or EJBLocalObject interfaces");
        }

        // Identify the bean type via bean interface reflection
        _beanType = "Session";
View Full Code Here

        // cache the Map.get method for efficiency
        try {
            _methodMapGet = java.util.Map.class.getMethod("get", new Class[]{Object.class});
        } catch (NoSuchMethodException e) {
            throw new ControlException("Can not find java.util.Map.get(Object) method");
        }
    }
View Full Code Here

                                        _implClass.getName() + "Initializer");
                _implInitializer = (ImplInitializer)initClass.newInstance();
            }
            catch (Exception e)
            {
                throw new ControlException("Control initialization failure", e);
            }
        }
        return _implInitializer;
    }
View Full Code Here

                // annotation, else downstream requirements (such as having a valid control init
                // class) will not be met.
                //
                if (_implClass.getAnnotation(ControlImplementation.class) == null)
                {
                    throw new ControlException("@org.apache.beehive.controls.api.bean.ControlImplementation annotation is missing from control implementation class: " + _implClass.getName());
                }
            }
            catch (ClassNotFoundException cnfe)
            {
                throw new ControlException("Unable to load control implementation: "  + implBinding, cnfe);
            }

            //
            // Cache the threading policy associated with the impl
            //
            Threading thr = (Threading)_implClass.getAnnotation(Threading.class);
            if ( thr != null )
                _threadingPolicy = thr.value();
            else
                _threadingPolicy = ThreadingPolicy.SINGLE_THREADED;    // default to single-threaded

            ensureThreadingBehaviour();

            try
            {
                //
                // Create and initialize the new instance
                //
                _control = _implClass.newInstance();

                try
                {
                    getImplInitializer().initialize(this, _control);
                    _hasServices = true;
                }
                catch (Exception e)
                {
                    throw new ControlException("Control initialization failure", e);
                }

                //
                // Once the control is initialized, then allow the associated context
                // to do any initialization.
                //
                ControlBeanContext cbcs = (ControlBeanContext)getBeanContextProxy();
                cbcs.initializeControl();
            }
            catch (RuntimeException re) { throw re; }   // never mask RuntimeExceptions
            catch (Exception e)
            {
                throw new ControlException("Unable to create control instance", e);
            }
        }

        //
        // If the implementation instance does not currently have contextual services, they
View Full Code Here

        // Services are always provided by the parent context.
        //
        ControlBeanContext cbc = getControlBeanContext();
        BeanContext bc = cbc.getBeanContext();
        if (bc == null || !(bc instanceof BeanContextServices))
            throw new ControlException("Can't locate service context: " + bc);

        //
        // Call getService on the parent context, using this bean as the requestor and the
        // associated peer context instance as the child and event listener parameters.
        //
View Full Code Here

                    break;
                }
            }
            if (!found)
            {
                throw new ControlException("Can't find base control interface for " + controlIntf);
            }
        }
        return controlIntf;
    }
View Full Code Here

            }

            //
            // Version requirement failed
            //
            throw new ControlException( "Control extension " + intfName + " fails version requirement: requires interface version " +
                    majorRequired + "." + minorRequired + ", found interface version " +
                    majorPresent + "." + minorPresent + "." );
        }
    }
View Full Code Here

     * Called during XMLDecoder reconstruction of a ControlBean.
     */
    public void decodeImpl(Object impl)
    {
        if (impl != _control)
            throw new ControlException("Cannot change implementation");
    };
View Full Code Here

            ControlFactory factory = (ControlFactory)factoryClass.newInstance();
            return factory.instantiate( beanClass, props, context, id );
        }
        catch ( Exception e )
        {
            throw new ControlException( "Exception creating ControlBean", e );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.beehive.controls.api.ControlException

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.