Search in sources :

Example 1 with AcsJJavaComponentHelperEx

use of alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx 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 AcsJJavaComponentHelperEx

use of alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx in project ACS by ACS-Community.

the class ComponentHelper method getOperationsInterface.

/**
	 * Gets the xxOperations interface as generated by the IDL compiler by calling {@link #_getOperationsInterface()}.
	 * @throws AcsJJavaComponentHelperEx  if the subclass methdod throws something or returns <code>null</code>. 
	 */
public final Class<? extends ACSComponentOperations> getOperationsInterface() throws AcsJJavaComponentHelperEx {
    Class<? extends ACSComponentOperations> opIF = null;
    try {
        opIF = _getOperationsInterface();
    } catch (Throwable thr) {
        AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx(thr);
        ex.setContextInfo("failed to retrieve 'operations' interface from component helper");
        throw ex;
    }
    if (opIF == null) {
        AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx();
        ex.setContextInfo("received null as the 'operations' IF class from the component helper.");
        throw ex;
    }
    return opIF;
}
Also used : AcsJJavaComponentHelperEx(alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)

Example 3 with AcsJJavaComponentHelperEx

use of alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx 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)

Example 4 with AcsJJavaComponentHelperEx

use of alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx in project ACS by ACS-Community.

the class ComponentHelper method getPOATieClass.

/**
	 * Gets the <code>Class</code> object for the POA tie skeleton class.
	 * The POA tie class is generated by the IDL compiler and must have
	 * a constructor that takes the operations interface as its only parameter.
	 * 
	 * @return the tie class.
	 */
final Class<? extends Servant> getPOATieClass() throws AcsJJavaComponentHelperEx {
    Class<? extends Servant> poaTieClass = null;
    try {
        poaTieClass = _getPOATieClass();
    } catch (Throwable thr) {
        AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx(thr);
        ex.setContextInfo("failed to obtain the POATie class from component helper.");
        throw ex;
    }
    if (poaTieClass == null) {
        AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx();
        ex.setContextInfo("received null as the POATie class from the component helper.");
        throw ex;
    }
    // check inheritance stuff (Servant should be checked by compiler under JDK 1.5, but operations IF is unknown at ACS compile time)
    if (!Servant.class.isAssignableFrom(poaTieClass)) {
        AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx();
        ex.setContextInfo("received invalid POATie class that is not a subclass of org.omg.PortableServer.Servant");
        throw ex;
    }
    if (!getOperationsInterface().isAssignableFrom(poaTieClass)) {
        AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx();
        ex.setContextInfo("POATie class '" + poaTieClass + "' does not implement the declared operations interface '" + getOperationsInterface().getName() + "'.");
        throw ex;
    }
    return poaTieClass;
}
Also used : AcsJJavaComponentHelperEx(alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx) Servant(org.omg.PortableServer.Servant)

Example 5 with AcsJJavaComponentHelperEx

use of alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx in project ACS by ACS-Community.

the class ComponentHelper method getInterfaceTranslator.

/**
	 * Method getInterfaceTranslator. Called by the container framework.
	 * @return Object
	 * @throws AcsJJavaComponentHelperEx
	 */
final Object getInterfaceTranslator() throws AcsJJavaComponentHelperEx {
    Object interfaceTranslator = null;
    // the dynamic proxy is the default interface translator
    Object defaultInterfaceTranslator = null;
    try {
        defaultInterfaceTranslator = DynamicProxyFactory.getDynamicProxyFactory(m_containerLogger).createServerProxy(getOperationsInterface(), m_componentImpl, getInternalInterface());
    } catch (Throwable thr) {
        throw new AcsJJavaComponentHelperEx(thr);
    }
    try {
        interfaceTranslator = _getInterfaceTranslator(defaultInterfaceTranslator);
    } catch (Throwable thr) {
        AcsJJavaComponentHelperEx ex = new AcsJJavaComponentHelperEx(thr);
        ex.setContextInfo("failed to obtain the custom interface translator.");
        throw ex;
    }
    if (interfaceTranslator == null) {
        // use default translator
        interfaceTranslator = defaultInterfaceTranslator;
    }
    return interfaceTranslator;
}
Also used : AcsJJavaComponentHelperEx(alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)

Aggregations

AcsJJavaComponentHelperEx (alma.JavaContainerError.wrappers.AcsJJavaComponentHelperEx)5 AcsJComponentCreationEx (alma.maciErrType.wrappers.AcsJComponentCreationEx)2 XmlComponentJ (alma.demo.XmlComponentJ)1 XmlComponentOperations (alma.demo.XmlComponentOperations)1 Servant (org.omg.PortableServer.Servant)1