final ComponentDescription component = new ComponentDescription(cad); final boolean classIsAbstract = Modifier.isAbstract(scannedClass.getScannedClass().getModifiers()); component.setAbstract(cad.getBooleanValue("componentAbstract", classIsAbstract)); component.setCreatePid(false); // always set to false component.setName(cad.getStringValue("name", scannedClass.getScannedClass().getName())); component.setLabel(cad.getStringValue("label", null)); component.setDescription(cad.getStringValue("description", null)); component.setCreateDs(cad.getBooleanValue("ds", true)); component.setCreateMetatype(cad.getBooleanValue("metatype", false)); component.setEnabled(cad.getBooleanValue("enabled", true)); component.setSpecVersion(SpecVersion.fromName(cad.getValue("specVersion").toString())); component.setFactory(cad.getStringValue("factory", null)); component.setImmediate(cad.getBooleanValue("immediate", false)); component.setInherit(cad.getBooleanValue("inherit", true)); component.setConfigurationPolicy(ComponentConfigurationPolicy.valueOf(cad.getEnumValue("policy", ComponentConfigurationPolicy.OPTIONAL.name()))); component.setSetMetatypeFactoryPid(cad.getBooleanValue("configurationFactory", false)); component.setConfigurationPid(cad.getStringValue("configurationPid", null));
for (final MethodAnnotation m : methodTags) { if (m.getName().equals(Activate.class.getName())) { cd.setActivate(m.getAnnotatedMethod().getName()); scannedClass.processed(m); } else if (m.getName().equals(Deactivate.class.getName())) { cd.setDeactivate(m.getAnnotatedMethod().getName()); scannedClass.processed(m); } else if (m.getName().equals(Modified.class.getName())) { cd.setModified(m.getAnnotatedMethod().getName()); scannedClass.processed(m);
final ComponentDescription cd = new ComponentDescription(cad); cd.setName(cad.getStringValue("name", classDescription.getDescribedClass().getName())); cd.setConfigurationPolicy(ComponentConfigurationPolicy.OPTIONAL); cd.setLabel(cad.getStringValue("label", null)); cd.setDescription(cad.getStringValue("description", null)); cd.setCreateMetatype(metatype); cd.setCreatePid(false); // always set to false
@Override public AbstractDescription clone() { final ComponentDescription cd = new ComponentDescription(this.annotation); cd.setName(this.getName()); cd.setLabel(this.getLabel()); cd.setDescription(this.getDescription()); cd.setConfigurationPolicy(this.getConfigurationPolicy()); cd.setAbstract(this.isAbstract); cd.setInherit(this.isInherit); cd.setCreateDs(this.isCreateDs()); cd.setCreateMetatype(this.isCreateMetatype()); cd.setEnabled(this.getEnabled()); cd.setImmediate(this.getImmediate()); cd.setFactory(this.getFactory()); cd.setSetMetatypeFactoryPid(this.isSetMetatypeFactoryPid()); cd.setActivate(this.getActivate()); cd.setDeactivate(this.getDeactivate()); cd.setModified(this.getModified()); cd.setSpecVersion(this.getSpecVersion()); cd.setConfigurationPid(this.getConfigurationPid()); return cd; } }
final ScannedClass scannedClass) throws SCRDescriptorException { final ComponentDescription component = new ComponentDescription(cad); describedClass.add(component); component.setAbstract(classIsAbstract); component.setName(cad.getStringValue("name", scannedClass.getScannedClass().getName())); component.setFactory(cad.getStringValue("factory", null)); component.setEnabled(cad.getBooleanValue("enabled", true)); component.setImmediate(cad.getBooleanValue("immediate", false)); component.setSpecVersion(spec); component.setConfigurationPolicy(ComponentConfigurationPolicy.valueOf(cad.getEnumValue("configurationPolicy", ComponentConfigurationPolicy.OPTIONAL.name()))); component.setConfigurationPid((String)configPid); } else if ( configPid instanceof String[] && ((String[])configPid).length == 1 ) { component.setConfigurationPid(((String[])configPid)[0]); } else { component.setConfigurationPid(null); component.setCreatePid(false); component.setInherit(false);
final SpecVersion intitialComponentSpecVersion = componentDesc.getSpecVersion(); if ( componentDesc.getConfigurationPid() != null && !componentDesc.getConfigurationPid().equals(componentDesc.getName())) { componentDesc.setSpecVersion(SpecVersion.VERSION_1_2); if ( !componentDesc.isAbstract() && componentDesc.isCreateMetatype() ) { ocd.setId( componentDesc.getName() ); if ( componentDesc.getLabel() != null ) { ocd.setName( componentDesc.getLabel() ); if ( componentDesc.getDescription() != null ) { ocd.setDescription( componentDesc.getDescription() ); if ( componentDesc.isSetMetatypeFactoryPid() ) { if ( componentDesc.getFactory() == null ) { ocd.setFactoryPid( componentDesc.getName() ); } else { iLog.addWarning( "Component factory " + componentDesc.getName() + " should not set metatype factory pid.", desc.getSource() ); if ( !componentDesc.isAbstract() && !componentDesc.isCreateMetatype() ) { if ( componentDesc.getLabel() != null && componentDesc.getLabel().trim().length() > 0 ) { iLog.addWarning(" Component " + componentDesc.getName() + " has set a label. However metatype is set to false. This label is ignored.", desc.getSource()); if ( componentDesc.getDescription() != null && componentDesc.getDescription().trim().length() > 0 ) { iLog.addWarning(" Component " + componentDesc.getName() + " has set a description. However metatype is set to false. This description is ignored.", desc.getSource());
this.isComponent = true; final ComponentDescription desc = new ComponentDescription(null); desc.setName(attributes.getValue(ATTR_NAME)); desc.setEnabled(Boolean.valueOf(attributes.getValue(COMPONENT_ATTR_ENABLED))); desc.setImmediate(Boolean.valueOf(attributes.getValue(COMPONENT_ATTR_IMMEDIATE))); desc.setFactory(attributes.getValue(COMPONENT_ATTR_FACTORY)); desc.setConfigurationPolicy(ComponentConfigurationPolicy.OPTIONAL); if ( policy != null ) { try { desc.setConfigurationPolicy(ComponentConfigurationPolicy.valueOf(policy.toUpperCase())); } catch (final IllegalArgumentException iae) { iLog.addWarning("Invalid value for attribute " + COMPONENT_ATTR_POLICY + " : " + policy, this.location); desc.setActivate(attributes.getValue(COMPONENT_ATTR_ACTIVATE)); desc.setDeactivate(attributes.getValue(COMPONENT_ATTR_DEACTIVATE)); desc.setModified(attributes.getValue(COMPONENT_ATTR_MODIFIED));
String nameOfAnnotatedClass = classDescription.getDescribedClass().getName(); final ComponentDescription cd = new ComponentDescription(cad); cd.setName(cad.getStringValue("componentName", nameOfAnnotatedClass)); cd.setConfigurationPolicy(ComponentConfigurationPolicy.valueOf(cad.getEnumValue("configurationPolicy", ComponentConfigurationPolicy.OPTIONAL.name()))); cd.setSetMetatypeFactoryPid(cad.getBooleanValue("configurationFactory", false)); cd.setLabel(cad.getStringValue("label", defaultLabel)); cd.setDescription(cad.getStringValue("description", "Health Check Configuration")); cd.setCreateMetatype(metatype); cd.setImmediate(immediate);
final ComponentDescription cd = new ComponentDescription(cad); cd.setName(cad.getStringValue("name", classDescription.getDescribedClass().getName())); cd.setConfigurationPolicy(ComponentConfigurationPolicy.OPTIONAL); cd.setLabel(cad.getStringValue("label", null)); cd.setDescription(cad.getStringValue("description", null)); cd.setCreateMetatype(metatype);
for (final MethodAnnotation m : methodTags) { if (m.getName().equals(Activate.class.getName())) { cd.setActivate(m.getAnnotatedMethod().getName()); scannedClass.processed(m); } else if (m.getName().equals(Deactivate.class.getName())) { cd.setDeactivate(m.getAnnotatedMethod().getName()); scannedClass.processed(m); } else if (m.getName().equals(Modified.class.getName())) { cd.setModified(m.getAnnotatedMethod().getName()); scannedClass.processed(m); } else if (m.getName().equals(Reference.class.getName()) ) {