Search in sources :

Example 1 with AcsJComponentCreationEx

use of alma.maciErrType.wrappers.AcsJComponentCreationEx in project ACS by ACS-Community.

the class ComponentHelper method getComponentImpl.

/**
	 * Gets the component implementation. 
	 * Must be the same object that also implements the functional interface
	 * obtained from <code>getInternalInterface</code>. 
	 * 
	 * @return  The component implementation class that implements <code>ComponentLifecycle</code>
	 *           and the functional interface.
 	 * @throws AcsJJavaComponentHelperEx  if the component implementation construction failed or 
 	 *                              if the component does not implement its declared functional interface. 
 	 */
protected final synchronized ComponentLifecycle getComponentImpl() throws AcsJComponentCreationEx, AcsJJavaComponentHelperEx {
    if (m_componentImpl == null) {
        Class<?> internalIF = null;
        try {
            m_componentImpl = _createComponentImpl();
            internalIF = getInternalInterface();
        } catch (AcsJComponentCreationEx ex) {
            throw ex;
        } catch (AcsJJavaComponentHelperEx ex) {
            throw ex;
        } catch (Throwable thr) {
            // the declared AcsJJavaComponentHelperEx
            throw new AcsJComponentCreationEx(thr);
        }
        if (m_componentImpl == null) {
            AcsJComponentCreationEx ex = new AcsJComponentCreationEx();
            ex.setReason("_createComponentImpl() returned null.");
            throw ex;
        }
        if (!internalIF.isInstance(m_componentImpl)) {
            AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx();
            ex.setContextInfo("component impl class '" + m_componentImpl.getClass().getName() + "' does not implement the specified functional IF " + internalIF.getName());
            throw ex;
        } else if (!ACSComponentOperations.class.isInstance(m_componentImpl)) {
            AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx();
            ex.setContextInfo("component impl class '" + m_componentImpl.getClass().getName() + "' does not implement the mandatory IF " + ACSComponentOperations.class.getName() + ". Check the IDL interface definition, and add ': ACS::ACSComponent'.");
            throw ex;
        }
        m_containerLogger.finer("component '" + componentInstanceName + "' (class '" + m_componentImpl.getClass().getName() + "') instantiated.");
    }
    return m_componentImpl;
}
Also used : AcsJComponentCreationEx(alma.maciErrType.wrappers.AcsJComponentCreationEx) AcsJJavaComponentHelperEx(alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)

Example 2 with AcsJComponentCreationEx

use of alma.maciErrType.wrappers.AcsJComponentCreationEx in project ACS by ACS-Community.

the class XmlComponentHelper method _getInterfaceTranslator.

/**
     * @see alma.acs.container.ComponentHelper#_getInterfaceTranslator(java.lang.Object)
     */
protected Object _getInterfaceTranslator(Object defaultInterfaceTranslator) throws AcsJJavaComponentHelperEx {
    XmlComponentJ impl = null;
    XmlComponentOperations opDelegate = null;
    try {
        impl = (XmlComponentJ) getComponentImpl();
    } catch (AcsJComponentCreationEx e) {
        throw new AcsJJavaComponentHelperEx(e);
    }
    opDelegate = (XmlComponentOperations) defaultInterfaceTranslator;
    return new IFTranslator(impl, opDelegate, getComponentLogger());
}
Also used : AcsJComponentCreationEx(alma.maciErrType.wrappers.AcsJComponentCreationEx) XmlComponentOperations(alma.demo.XmlComponentOperations) XmlComponentJ(alma.demo.XmlComponentJ) AcsJJavaComponentHelperEx(alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)

Aggregations

AcsJJavaComponentHelperEx (alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)2 AcsJComponentCreationEx (alma.maciErrType.wrappers.AcsJComponentCreationEx)2 XmlComponentJ (alma.demo.XmlComponentJ)1 XmlComponentOperations (alma.demo.XmlComponentOperations)1