Search in sources :

Example 21 with AcsJContainerServicesEx

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

the class ContainerServicesImpl method getCollocatedComponent.

public org.omg.CORBA.Object getCollocatedComponent(ComponentQueryDescriptor spec, boolean markAsDefaul, String targetCompUrl) throws AcsJContainerServicesEx {
    if (spec == null) {
        AcsJBadParameterEx cause = new AcsJBadParameterEx();
        cause.setParameter("ComponentQueryDescriptor");
        cause.setParameterValue("null");
        throw new AcsJContainerServicesEx(cause);
    }
    if (targetCompUrl == null) {
        AcsJBadParameterEx cause = new AcsJBadParameterEx();
        cause.setParameter("targetCompUrl");
        cause.setParameterValue("null");
        throw new AcsJContainerServicesEx(cause);
    }
    ComponentInfo cInfo = null;
    try {
        // the call
        cInfo = m_acsManagerProxy.get_collocated_component(getEffectiveClientHandle(), spec.toComponentSpec(), false, targetCompUrl);
    } catch (AcsJmaciErrTypeEx ex) {
        String msg = "Failed to retrieve component '" + spec.getComponentName() + "' created such that it runs collocated with '" + targetCompUrl + "'.";
        // it's serious, but the caller is supposed to log this. Container only logs just in case.
        m_logger.log(Level.FINE, msg, ex);
        throw new AcsJContainerServicesEx(ex);
    } catch (Throwable thr) {
        String msg = "Unexpectedly failed to retrieve component '" + spec.getComponentName() + "' created such that it runs collocated with '" + targetCompUrl + "'.";
        m_logger.log(Level.FINE, msg, thr);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
        ex.setContextInfo(msg);
        throw ex;
    }
    // @todo check and remove this
    if (cInfo.reference == null) {
        String msg = "Failed to retrieve component '" + spec.getComponentName() + "' created such that it runs collocated with '" + targetCompUrl + "'.";
        m_logger.info(msg);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
        ex.setContextInfo(msg);
        throw ex;
    }
    m_usedComponentsMap.put(cInfo.name, cInfo.reference);
    m_componentDescriptorMap.put(cInfo.name, new ComponentDescriptor(cInfo));
    return cInfo.reference;
}
Also used : AcsJBadParameterEx(alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx) ComponentDescriptor(alma.acs.component.ComponentDescriptor) ComponentInfo(si.ijs.maci.ComponentInfo) AcsJmaciErrTypeEx(alma.maciErrType.wrappers.AcsJmaciErrTypeEx) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 22 with AcsJContainerServicesEx

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

the class ContainerServicesImpl method checkOffShoot.

/**
	 * @param cbServant
	 * @throws ContainerException
	 */
private void checkOffShoot(Object servant) throws AcsJContainerServicesEx {
    if (servant == null) {
        AcsJBadParameterEx cause = new AcsJBadParameterEx();
        cause.setParameter("servant");
        cause.setParameterValue("null");
        throw new AcsJContainerServicesEx(cause);
    }
    if (!(servant instanceof OffShootOperations)) {
        String msg = "invalid offshoot servant provided. Must implement " + OffShootOperations.class.getName();
        m_logger.fine(msg);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
        ex.setContextInfo(msg);
        throw ex;
    }
}
Also used : AcsJBadParameterEx(alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx) OffShootOperations(alma.ACS.OffShootOperations) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 23 with AcsJContainerServicesEx

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

the class ContainerServicesImpl method getDynamicComponent.

/**
	 * @see alma.acs.container.ContainerServices#getDynamicComponent(si.ijs.maci.ComponentSpec, boolean)
	 */
public org.omg.CORBA.Object getDynamicComponent(ComponentSpec compSpec, boolean markAsDefault) throws AcsJContainerServicesEx {
    String entryMsg = "getDynamicComponent called with" + " compName=" + compSpec.component_name + " compType=" + compSpec.component_type + " compCode=" + compSpec.component_code + " compContainer=" + compSpec.container_name + " markAsDefault=" + markAsDefault;
    m_logger.fine(entryMsg);
    ComponentInfo cInfo = null;
    try {
        // the call
        cInfo = m_acsManagerProxy.get_dynamic_component(getEffectiveClientHandle(), compSpec, markAsDefault);
        m_usedComponentsMap.put(cInfo.name, cInfo.reference);
        m_componentDescriptorMap.put(cInfo.name, new ComponentDescriptor(cInfo));
    } catch (AcsJmaciErrTypeEx ex) {
        m_logger.log(Level.FINE, "Failed to create dynamic component", ex);
        throw new AcsJContainerServicesEx(ex);
    } catch (Throwable thr) {
        String msg = "Unexpectedly failed to create dynamic component for unexpected reasons!";
        m_logger.log(Level.FINE, msg, thr);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
        ex.setContextInfo(msg);
        throw ex;
    }
    return cInfo.reference;
}
Also used : ComponentDescriptor(alma.acs.component.ComponentDescriptor) ComponentInfo(si.ijs.maci.ComponentInfo) AcsJmaciErrTypeEx(alma.maciErrType.wrappers.AcsJmaciErrTypeEx) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 24 with AcsJContainerServicesEx

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

the class ContainerServicesImpl method findComponents.

/**
	 * @see alma.acs.container.ContainerServices#findComponents(java.lang.String, java.lang.String)
	 */
@Override
public String[] findComponents(String curlWildcard, String typeWildcard) throws AcsJContainerServicesEx {
    if (curlWildcard == null) {
        curlWildcard = "*";
    }
    if (typeWildcard == null) {
        typeWildcard = "*";
    }
    String msgSpec = "curlWildcard='" + curlWildcard + "' and typeWildcard='" + typeWildcard + "'.";
    if (m_logger.isLoggable(Level.FINER)) {
        m_logger.finer("about to call Manager#get_component_info with " + msgSpec);
    }
    ComponentInfo[] components = null;
    try {
        components = m_acsManagerProxy.get_component_info(new int[0], curlWildcard, typeWildcard, false);
    } catch (AcsJNoPermissionEx ex) {
        m_logger.log(Level.FINE, "No permission to find components with " + msgSpec, ex);
        AcsJContainerServicesEx ex2 = new AcsJContainerServicesEx(ex);
        ex2.setContextInfo(msgSpec);
        throw ex2;
    } catch (Throwable thr) {
        m_logger.log(Level.FINE, "Unexpected failure calling 'get_component_info' with " + msgSpec, thr);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
        ex.setContextInfo(msgSpec);
        throw ex;
    }
    ArrayList<String> curls = new ArrayList<String>();
    if (components != null) {
        for (int i = 0; i < components.length; i++) {
            curls.add(components[i].name);
        }
    }
    if (m_logger.isLoggable(Level.FINER)) {
        m_logger.finer("received " + curls.size() + " curls from get_component_info.");
    }
    return curls.toArray(new String[curls.size()]);
}
Also used : AcsJNoPermissionEx(alma.maciErrType.wrappers.AcsJNoPermissionEx) ArrayList(java.util.ArrayList) ComponentInfo(si.ijs.maci.ComponentInfo) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 25 with AcsJContainerServicesEx

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

the class SimpleSupplierReconnClient method createPublisherAndSubscriber.

public void createPublisherAndSubscriber() {
    try {
        m_client = new ComponentClient(m_logger, System.getProperty("ACS.manager"), "SimpleSupplierReconnClient");
        m_publisher = m_client.getContainerServices().createNotificationChannelPublisher(CHANNEL_NAME, IDLEntity.class);
        ((NCPublisher) m_publisher).setAutoreconnect(m_autoreconnect);
        m_publisher.enableEventQueue(100, m_cbObj);
    //m_publisher.setAutoreconnect(m_autoreconnect);
    } catch (AcsJContainerServicesEx e) {
    // Silently ignore the errors
    } catch (AcsJException e) {
    // Shouldn't happen
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ComponentClient(alma.acs.component.client.ComponentClient) AcsJException(alma.acs.exceptions.AcsJException) NCPublisher(alma.acs.nc.NCPublisher) IDLEntity(org.omg.CORBA.portable.IDLEntity) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx) AcsJException(alma.acs.exceptions.AcsJException)

Aggregations

AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)51 AcsJBadParameterEx (alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx)10 AcsJException (alma.acs.exceptions.AcsJException)6 AcsJmaciErrTypeEx (alma.maciErrType.wrappers.AcsJmaciErrTypeEx)6 ComponentDescriptor (alma.acs.component.ComponentDescriptor)5 DAL (com.cosylab.CDB.DAL)5 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)4 ComponentInfo (si.ijs.maci.ComponentInfo)4 OffShootOperations (alma.ACS.OffShootOperations)3 AcsJIllegalArgumentEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)3 EntityT (alma.entities.commonentity.EntityT)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 Any (org.omg.CORBA.Any)3 NamingContext (org.omg.CosNaming.NamingContext)3 Servant (org.omg.PortableServer.Servant)3 OffShoot (alma.ACS.OffShoot)2 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)2 AcsJContainerEx (alma.JavaContainerError.wrappers.AcsJContainerEx)2 ComponentClient (alma.acs.component.client.ComponentClient)2 AcsManagerProxy (alma.acs.container.AcsManagerProxy)2