/** * @return the factory's name. */ public String getFactory() { return architecture.getInstanceDescription().getComponentDescription().getName(); }
/** * Does the service instance match with the given factory ? * @param fact : the factory to test. * @return true if the factory match, false otherwise. */ public boolean match(ServiceReference fact) { // Check if the factory can provide the specification ComponentTypeDescription desc = (ComponentTypeDescription) fact.getProperty("component.description"); if (desc == null) { return false; // No component type description. } String[] provides = desc.getprovidedServiceSpecification(); for (int i = 0; provides != null && i < provides.length; i++) { if (provides[i].equals(m_specification)) { // Check that the factory needs every properties contained in // the configuration PropertyDescription[] props = desc.getProperties(); Properties conf = new Properties(); Enumeration keys = m_configuration.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (!containsProperty(key, props)) { return false; } conf.put(key, m_configuration.get(key)); } Factory factory = (Factory) getService(fact); return factory.isAcceptable(conf); } } return false; }
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. */ public void addProperty(String name, String value) { addProperty(name, value, false); }
Set<String> parentClasses = new HashSet<String>(); try { computeInterfacesAndSuperClasses(serviceSpecification, parent, desc.getBundleContext().getBundle(), interfaces, parentClasses); getLogger().log(Logger.INFO, "Collected interfaces from " + metadata.getAttribute("classname") + " : " + interfaces); getLogger().log(Logger.INFO, "Collected super classes from " + metadata.getAttribute("classname") + " : " + parentClasses); if (!interfaces.contains(itf) && !parentClasses.contains(itf) && !desc.getFactory().getClassName().equals(itf)) { desc.getFactory().getLogger().log(Logger.ERROR, "The specification " + itf + " is not implemented by " + metadata.getAttribute("classname")); interfaces.add(desc.getFactory().getClassName()); set.remove(Pojo.class.getName()); // Remove POJO. for (String spec : set) { desc.addProvidedServiceSpecification(spec); if (specs == null) { specs = new StringBuffer("{"); desc.addProperty(pd);
throw new MissingHandlerException(getMissingHandlers()); props = m_componentDesc.getProperties(); // Stack confinement.
throw new ConfigurationException("Malformed provides : the specification attribute is mandatory"); } else { desc.addProvidedServiceSpecification(spec); throw new ConfigurationException("Malformed exports - Missing the specification attribute"); } else { desc.addProvidedServiceSpecification(spec);
/** * Gets the component type description. * @return the component type description */ public ComponentTypeDescription getComponentTypeDescription() { return new ComponentTypeDescription(this); }
Set<String> parentClasses = new HashSet<String>(); try { computeInterfacesAndSuperClasses(serviceSpecification, parent, desc.getBundleContext().getBundle(), interfaces, parentClasses); getLogger().log(Logger.INFO, "Collected interfaces from " + metadata.getAttribute("classname") + " : " + interfaces); getLogger().log(Logger.INFO, "Collected super classes from " + metadata.getAttribute("classname") + " : " + parentClasses); if (!interfaces.contains(itf) && !parentClasses.contains(itf) && !desc.getFactory().getClassName().equals(itf)) { desc.getFactory().getLogger().log(Logger.ERROR, "The specification " + itf + " is not implemented by " + metadata.getAttribute("classname")); interfaces.add(desc.getFactory().getClassName()); set.remove(Pojo.class.getName()); // Remove POJO. for (String spec : set) { desc.addProvidedServiceSpecification(spec); if (specs == null) { specs = new StringBuffer("{"); desc.addProperty(pd);
throw new MissingHandlerException(getMissingHandlers()); props = m_componentDesc.getProperties(); // Stack confinement.
throw new ConfigurationException("Malformed provides : the specification attribute is mandatory"); } else { desc.addProvidedServiceSpecification(spec); throw new ConfigurationException("Malformed exports - Missing the specification attribute"); } else { desc.addProvidedServiceSpecification(spec);
/** * Gets the component type description. * @return the component type description */ public ComponentTypeDescription getComponentTypeDescription() { return new ComponentTypeDescription(this); }
/** * Creates the Json representation for an invalid controller. * * @param description the instance's description * @param json the json service * @return the json representation */ public static JsonNode from(InstanceDescription description, Json json) { ObjectNode node = json.newObject(); node.put("classname", description.getComponentDescription().getName()) .put("invalid", description.getState() == ComponentInstance.INVALID) .put("reason", extractInvalidityReason(description)); return node; }
/** * Does the service instance match with the given factory ? * @param fact : the factory to test. * @return true if the factory match, false otherwise. */ public boolean match(ServiceReference fact) { // Check if the factory can provide the specification ComponentTypeDescription desc = (ComponentTypeDescription) fact.getProperty("component.description"); if (desc == null) { return false; // No component type description. } String[] provides = desc.getprovidedServiceSpecification(); for (int i = 0; provides != null && i < provides.length; i++) { if (provides[i].equals(m_specification)) { // Check that the factory needs every properties contained in // the configuration PropertyDescription[] props = desc.getProperties(); Properties conf = new Properties(); Enumeration keys = m_configuration.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (!containsProperty(key, props)) { return false; } conf.put(key, m_configuration.get(key)); } Factory factory = (Factory) getService(fact); return factory.isAcceptable(conf); } } return false; }
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. */ public void addProperty(String name, String value) { addProperty(name, value, false); }
/** * Gets the instance list created by the given factory. * @param archs the list of instance architectures * @param factory the factory name * @return the list containing the created instances (name) */ public static List<String> getInstanceList(List<Architecture> archs, String factory) { List<String> list = new ArrayList<String>(); for (Architecture arch : archs) { // Cannot be null, an empty list is returned. String n = arch.getInstanceDescription().getComponentDescription().getName(); if (factory.equals(n)) { list.add(arch.getInstanceDescription().getName()); } } return list; }
if (factory.getComponentDescription().getprovidedServiceSpecification().length != 0) { pw.key("services"); pw.value(factory.getComponentDescription().getprovidedServiceSpecification()); PropertyDescription[] props = factory.getComponentDescription().getProperties(); if (props != null && props.length != 0) { pw.key("properties");
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. * @param immutable : the property is immutable. */ public void addProperty(String name, String value, boolean immutable) { addProperty(new PropertyDescription(name, String.class.getName(), value, immutable)); }
throw new ConfigurationException("Malformed service : the specification attribute is mandatory"); String filter = "(&(!(factory.name=" + getCompositeManager().getFactory().getComponentDescription().getName() + "))(factory.state=1))"; // Cannot reinstantiate yourself String givenFilter = service.getAttribute("filter"); if (givenFilter != null) {
/** * Adds a String property in the component type. * * @param name : property name. * @param value : property value. * @param immutable : the property is immutable. */ public void addProperty(String name, String value, boolean immutable) { addProperty(new PropertyDescription(name, String.class.getName(), value, immutable)); }
throw new ConfigurationException("Malformed service : the specification attribute is mandatory"); String filter = "(&(!(factory.name=" + getCompositeManager().getFactory().getComponentDescription().getName() + "))(factory.state=1))"; // Cannot reinstantiate yourself String givenFilter = service.getAttribute("filter"); if (givenFilter != null) {