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;
}
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;
}
Aggregations