private void doProperties(aQute.lib.osgi.Annotation annotation) { Object[] properties = annotation.get(Component.PROPERTIES); if (properties != null) { for (Object o : properties) { String p = (String) o; if (PROPERTY_PATTERN.matcher(p).matches()) this.properties.add(p); else throw new IllegalArgumentException("Malformed property '" + p + "' on: " + annotation.get(Component.NAME)); } } }
public void annotation(Annotation annotation) { def.name = annotation.get("name"); def.factory = annotation.get("factory"); def.enabled = annotation.get("enabled"); def.immediate = annotation.get("immediate"); String cp = (String) annotation.get("configurationPolicy"); if (cp != null) { def.configurationPolicy = cp.toLowerCase(); Object[] provides = (Object[]) annotation.get("provides"); if (provides == null) { def.provides = interfaces; } else if (annotation.getName().equals(REFERENCE_ANNOTATION)) { ComponentDef.Reference ref = getReference(annotation, method); ref.multiple = (Boolean) annotation.get("multiple"); ref.optional = (Boolean) annotation.get("optional"); ref.dynamic = (Boolean) annotation.get("dynamic"); Integer c = annotation.get("type"); if (c != null) { switch (c.intValue()) { ref.target = (String) annotation.get("target"); ref.bind = method; setService(ref, methodDescriptor);
id = this.designatePid; // for the felix problems } else { if (ocdAnnotation.get("factory") != null) { factory = true;
set(COMPONENT_NAME, annotation.get(Component.NAME), "<>"); set(COMPONENT_FACTORY, annotation.get(Component.FACTORY), false); setBoolean(COMPONENT_ENABLED, annotation.get(Component.ENABLED), true); setBoolean(COMPONENT_IMMEDIATE, annotation.get(Component.IMMEDIATE), false); setBoolean(COMPONENT_SERVICEFACTORY, annotation.get(Component.SERVICEFACTORY), false); if (annotation.get(Component.DESIGNATE) != null) { String configs = annotation.get(Component.DESIGNATE); if (configs != null) { set(COMPONENT_DESIGNATE, Clazz.objectDescriptorToFQN(configs), ""); if (annotation.get(Component.DESIGNATE_FACTORY) != null) { String configs = annotation.get(Component.DESIGNATE_FACTORY); if (configs != null) { set(COMPONENT_DESIGNATEFACTORY, Clazz.objectDescriptorToFQN(configs), ""); setVersion((String) annotation.get(Component.VERSION)); String configurationPolicy = annotation.get(Component.CONFIGURATION_POLICY); if (configurationPolicy != null) set(COMPONENT_CONFIGURATION_POLICY, configurationPolicy.toLowerCase(), ""); Object[] provides = (Object[]) annotation.get(Component.PROVIDE); String[] p; if (provides == null) { String name = (String) annotation.get(Reference.NAME); String bind = method; String unbind = null;
private Reference getReference(Annotation annotation, String method) { String name = (String) annotation.get("name"); if (name == null) { Matcher m = BINDMETHOD.matcher(method); if (m.matches()) { name = m.group(2).toLowerCase() + m.group(3); } else name = method; } return def.newReference(name); }
String version = a.get("value"); if (!info.containsKey(Constants.VERSION_ATTRIBUTE)) { if (version != null) { Map<String, String> attrs = doAttrbutes((Object[]) a.get(Export.MANDATORY), clazz, getReplacer()); if (!attrs.isEmpty()) { attrs = doAttrbutes((Object[]) a.get(Export.OPTIONAL), clazz, getReplacer()); if (!attrs.isEmpty()) { info.putAll(attrs); Object[] included = a.get(Export.INCLUDE); if (included != null && included.length > 0) { StringBuilder sb = new StringBuilder(); Object[] excluded = a.get(Export.EXCLUDE); if (excluded != null && excluded.length > 0) { StringBuilder sb = new StringBuilder(); Object[] uses = a.get(Export.USES); if (uses != null && uses.length > 0) { String old = info.get(USES_DIRECTIVE);
component.factory = comp.factory(); component.configurationPolicy = comp.configurationPolicy(); if (annotation.get("enabled") != null) component.enabled = comp.enabled(); if (annotation.get("factory") != null) component.factory = comp.factory(); if (annotation.get("immediate") != null) component.immediate = comp.immediate(); if (annotation.get("servicefactory") != null) component.servicefactory = comp.servicefactory(); Object [] x = annotation.get("service");
def.bind = method; def.interfce = raw.get("service"); if (def.interfce != null) { def.interfce = Clazz.objectDescriptorToFQN(def.interfce);