Search in sources :

Example 1 with ComponentDescriptor

use of alma.acs.component.ComponentDescriptor in project ACS by ACS-Community.

the class SampTool method initializeComponents.

public static void initializeComponents() throws AcsJContainerEx, AcsInformationException {
    info = AcsInformation.getInstance(NAME);
    /* Get all component names and descriptors */
    List<String> listTmp = new ArrayList<String>();
    compList = info.getCManager().getComponentsName();
    cServices = info.getContainerServices();
    for (int i = 0; i < compList.length; i++) {
        try {
            ComponentDescriptor c = cServices.getComponentDescriptor(compList[i]);
            /* Check which of them are Sampling Managers */
            if (c.getType().equals(SAMP_MAN_IFACE)) {
                sampManList.add(c.getName());
                info.getContainerServices().getLogger().info("Found Sampling Manager " + c.getName());
            } else /* If they are not, then add them to the component list */
            {
                listTmp.add(compList[i]);
                cDescriptorList.add(c);
                propList.add(null);
            }
        } catch (AcsJContainerServicesEx e) {
            e.getMessage();
        }
    }
    compList = new String[listTmp.size()];
    compList = listTmp.toArray(compList);
    Arrays.sort(compList);
}
Also used : ComponentDescriptor(alma.acs.component.ComponentDescriptor) ArrayList(java.util.ArrayList) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 2 with ComponentDescriptor

use of alma.acs.component.ComponentDescriptor in project ACS by ACS-Community.

the class ContainerServicesTesterImpl method testGetDynamicDummyComponent.

/**
	 * @see alma.jconttest.ContainerServicesTesterOperations#testGetDynamicDummyComponent(org.omg.CORBA.StringHolder)
	 */
public boolean testGetDynamicDummyComponent(StringHolder compName) {
    boolean ret = false;
    try {
        ComponentQueryDescriptor compQueryDesc = new ComponentQueryDescriptor();
        //			compQueryDesc.setComponentName(ComponentQueryDescriptor.ANY);
        compQueryDesc.setComponentType(DummyComponentHelper.DUMMYCOMPONENT_CORBATYPE);
        org.omg.CORBA.Object compObj = m_containerServices.getDynamicComponent(compQueryDesc, false);
        DummyComponent dummyComp = alma.jconttest.DummyComponentHelper.narrow(compObj);
        // return the name that was dynamically assigned
        compName.value = dummyComp.name();
        m_logger.info("received dynamic instance of " + DummyComponentHelper.DUMMYCOMPONENT_CORBATYPE);
        // now check the component descriptor
        ComponentDescriptor compDesc = m_containerServices.getComponentDescriptor(compName.value);
        m_logger.info("Component data: " + compDesc.toString());
        m_containerServices.releaseComponent(dummyComp.name());
        ret = true;
    } catch (Exception e) {
        // todo: IDL ex
        m_logger.warning(e.toString());
        // prevent CORBA marshalling ex
        compName.value = "!!!failed!!!";
    }
    return ret;
}
Also used : DummyComponent(alma.jconttest.DummyComponent) ComponentDescriptor(alma.acs.component.ComponentDescriptor) ComponentQueryDescriptor(alma.acs.component.ComponentQueryDescriptor)

Example 3 with ComponentDescriptor

use of alma.acs.component.ComponentDescriptor in project ACS by ACS-Community.

the class ContainerServicesImpl method getComponentDescriptor.

/**
	 * 
	 * @see alma.acs.container.ContainerServices#getComponentDescriptor(java.lang.String)
	 */
public ComponentDescriptor getComponentDescriptor(String curl) throws AcsJContainerServicesEx {
    if (curl == null) {
        AcsJBadParameterEx cause = new AcsJBadParameterEx();
        cause.setParameter("curl");
        cause.setParameterValue("null");
        throw new AcsJContainerServicesEx(cause);
    }
    ComponentDescriptor desc = m_componentDescriptorMap.get(curl);
    if (desc == null) {
        // try to get it from the manager
        ComponentInfo[] compInfos;
        try {
            compInfos = m_acsManagerProxy.get_component_info(new int[0], curl, "*", false);
        } catch (Throwable thr) {
            m_logger.log(Level.FINE, "Unexpected failure calling 'get_component_info'.", thr);
            AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
            ex.setContextInfo("CURL=" + curl);
            throw ex;
        }
        if (compInfos.length == 1) {
            desc = new ComponentDescriptor(compInfos[0]);
            m_componentDescriptorMap.put(curl, desc);
        } else {
            String msg = "failed to retrieve a unique component descriptor for the component instance " + curl;
            m_logger.fine(msg);
            AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
            ex.setContextInfo(msg);
            throw new AcsJContainerServicesEx();
        }
    }
    return desc;
}
Also used : AcsJBadParameterEx(alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx) ComponentDescriptor(alma.acs.component.ComponentDescriptor) ComponentInfo(si.ijs.maci.ComponentInfo) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 4 with ComponentDescriptor

use of alma.acs.component.ComponentDescriptor 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 5 with ComponentDescriptor

use of alma.acs.component.ComponentDescriptor 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)

Aggregations

ComponentDescriptor (alma.acs.component.ComponentDescriptor)7 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)5 ComponentInfo (si.ijs.maci.ComponentInfo)4 AcsJBadParameterEx (alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx)3 AcsJmaciErrTypeEx (alma.maciErrType.wrappers.AcsJmaciErrTypeEx)3 ArrayList (java.util.ArrayList)2 ComponentQueryDescriptor (alma.acs.component.ComponentQueryDescriptor)1 DummyComponent (alma.jconttest.DummyComponent)1 InterfaceDef (org.omg.CORBA.InterfaceDef)1