Search in sources :

Example 6 with ComponentDescriptor

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

the class ComponentsManager method getComponentProperties.

/**
	 * Gets a list of properties name from a given component.
	 * @param componentName string with the component name.
	 * @return array of strings.
	 * FIXME: does it have to be case sensitive??
	 * FIXME: Must handle the exception.
	 **/
public List<String> getComponentProperties(String componentName) {
    List<String> tmp = new ArrayList<String>();
    if (componentExists(componentName)) {
        try {
            ComponentDescriptor desc = cServices.getComponentDescriptor(componentName);
            InterfaceDef ifdef = InterfaceDefHelper.narrow(rep.lookup_id(desc.getType()));
            if (ifdef == null)
                return null;
            // begin
            /*
				FullInterfaceDescription ifdes = ifdef.describe_interface();
                for(int i = 0 ; i < ifdes.attributes.length ; i++){
                        TypeCode tc = ifdes.attributes[i].type;
                        if(tc.kind() != TCKind.tk_objref)
                        	continue;
                        InterfaceDef tcdef = InterfaceDefHelper.narrow(rep.lookup_id(tc.id()));
                        if(tc.kind() == TCKind.tk_objref && tcdef.is_a(IDL_PROPERTY))
                                tmp.add(ifdes.attributes[i].name);
                }
                //end
                */
            tmp = getComponentProperties(ifdef);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return tmp;
}
Also used : InterfaceDef(org.omg.CORBA.InterfaceDef) ComponentDescriptor(alma.acs.component.ComponentDescriptor) ArrayList(java.util.ArrayList)

Example 7 with ComponentDescriptor

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

the class ContainerServicesImpl method getDefaultComponent.

/**
	 * @see alma.acs.container.ContainerServices#getDefaultComponent(java.lang.String)
	 */
public org.omg.CORBA.Object getDefaultComponent(String componentIDLType) throws AcsJContainerServicesEx {
    if (componentIDLType == null) {
        AcsJBadParameterEx cause = new AcsJBadParameterEx();
        cause.setParameter("componentIDLType");
        cause.setParameterValue("null");
        throw new AcsJContainerServicesEx(cause);
    }
    ComponentInfo cInfo = null;
    try {
        // the call
        cInfo = m_acsManagerProxy.get_default_component(getEffectiveClientHandle(), componentIDLType);
    } catch (AcsJmaciErrTypeEx ex) {
        String msg = "failed to retrieve default component for type " + componentIDLType;
        // higher-level log should be produced by the calling client from the exception later
        m_logger.log(Level.FINE, msg, ex);
        throw new AcsJContainerServicesEx(ex);
    } catch (Throwable thr) {
        String msg = "failed to retrieve default component for type " + componentIDLType + " for unexpected reasons!";
        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 = "Default component for type '" + componentIDLType + "' could not be accessed. ";
        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)

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