All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.beehive.controls.system.jms.impl.JMSControlImplInitializer Maven / Gradle / Ivy

The newest version!
package org.apache.beehive.controls.system.jms.impl;

import java.lang.reflect.Field;
import org.apache.beehive.controls.api.ControlException;
import org.apache.beehive.controls.api.context.ControlBeanContext;
import org.apache.beehive.controls.runtime.bean.ControlBean;

@SuppressWarnings("all")
public class JMSControlImplInitializer
extends org.apache.beehive.controls.runtime.bean.ImplInitializer
{
    static final Field __resourceContextField;
    static final Field __contextField;
    static
    {
        try
        {
            __resourceContextField = org.apache.beehive.controls.system.jms.impl.JMSControlImpl.class.getDeclaredField("_resourceContext");
            __resourceContextField.setAccessible(true);
            __contextField = org.apache.beehive.controls.system.jms.impl.JMSControlImpl.class.getDeclaredField("_context");
            __contextField.setAccessible(true);
        }
        catch (NoSuchFieldException __bc_nsfe)
        {
            throw new ExceptionInInitializerError(__bc_nsfe);
        }
    }
    
    protected static class _resourceContextResourceEventsEventAdaptor implements org.apache.beehive.controls.api.context.ResourceContext.ResourceEvents, java.io.Serializable
    {
        private static final long serialVersionUID = 1L;
        
        org.apache.beehive.controls.system.jms.impl.JMSControlImpl __bc_impl;
        
        _resourceContextResourceEventsEventAdaptor(org.apache.beehive.controls.system.jms.impl.JMSControlImpl impl) { __bc_impl = impl; }
        
        public void onRelease() 
        {
            __bc_impl.onRelease();
        }
        public void onAcquire() 
        {
            __bc_impl.onAcquire();
        }
    }
    
    
    /**
    * Initializes the nested contextual services required by the implementation
    */
    public void initServices(ControlBean bean, Object target)
    {
        org.apache.beehive.controls.system.jms.impl.JMSControlImpl __bc_impl = (org.apache.beehive.controls.system.jms.impl.JMSControlImpl)target;
        
        super.initServices(bean, __bc_impl);
        
        ControlBeanContext __bc_beanContext = bean.getControlBeanContext();
        try
        {
            org.apache.beehive.controls.api.context.ResourceContext __resourceContext = (org.apache.beehive.controls.api.context.ResourceContext)__bc_beanContext.getService(org.apache.beehive.controls.api.context.ResourceContext.class, null);
            if (__resourceContext == null)
            throw new ControlException("Contextual service org.apache.beehive.controls.api.context.ResourceContext is not available");
            __resourceContext.addResourceEventsListener(new _resourceContextResourceEventsEventAdaptor(__bc_impl));
            __resourceContextField.set(__bc_impl, __resourceContext);
            org.apache.beehive.controls.api.context.ControlBeanContext __context = __bc_beanContext;
            if (__context == null)
            throw new ControlException("Contextual service org.apache.beehive.controls.api.context.ControlBeanContext is not available");
            __contextField.set(__bc_impl, __context);
        }
        catch (RuntimeException __bc_re) { throw __bc_re; }
        catch (Exception __bc_e)
        {
            throw new ControlException("Contextual service initialization failure", __bc_e);
        }
    }
    
    /**
    * Resets all nested contextual services instances to null
    */
    public void resetServices(ControlBean bean, Object target)
    {
        org.apache.beehive.controls.system.jms.impl.JMSControlImpl __bc_impl = (org.apache.beehive.controls.system.jms.impl.JMSControlImpl)target;
        
        super.resetServices(bean, __bc_impl);
        
        try
        {
            __resourceContextField.set(__bc_impl, null);
            __contextField.set(__bc_impl, null);
        }
        catch (RuntimeException __bc_re) { throw __bc_re; }
        catch (Exception __bc_e)
        {
            throw new ControlException("Contextual service reset failure", __bc_e);
        }
    }
    
    /**
    * Initializes the nested client event proxies required by the implementation
    */
    public void initControls(ControlBean bean, Object target)
    {
        org.apache.beehive.controls.system.jms.impl.JMSControlImpl __bc_impl = (org.apache.beehive.controls.system.jms.impl.JMSControlImpl)target;
        // DO NOT DELEGATE TO SUPERCLASS HERE.  THE CONTROL CLIENT INIT HIERARCHY
        // WILL INITIALIZE ALL THE WAY DOWN TO THE BASE CLASS!
        
        try
        {
            org.apache.beehive.controls.system.jms.impl.JMSControlImplClientInitializer.initialize(bean.getControlBeanContext(), __bc_impl);
        }
        catch (RuntimeException __bc_re) { throw __bc_re; }
        catch (Exception __bc_e)
        {
            throw new ControlException("Client event proxy initialization failure", __bc_e);
        }
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy