Package org.apache.felix.ipojo.parser

Examples of org.apache.felix.ipojo.parser.FieldMetadata


     * @return the type of the field or {@code null} if it wasn't found
     */
    private static String getTypeFromAttributeField(String fieldRequire,
            PojoMetadata manipulation) {

        FieldMetadata field = manipulation.getField(fieldRequire);
        if (field == null) {
            return null;
        } else {
            return FieldMetadata.getReflectionType(field.getFieldType());
        }
    }
View Full Code Here


                    if (object != null) {
                        prop.setValue(object);
                    }

                    if (field != null) {
                        getInstanceManager().register(new FieldMetadata(field, type), this);
                        // Cannot register the property as the interception is necessary
                        // to deal with registration update.
                    }
                }

                // Attach to properties to the provided service
                svc.setProperties(properties);
            }

            Element[] controllers = providedService.getElements("Controller");
            if (controllers != null) {
                for (Element controller : controllers) {
                    String field = controller.getAttribute("field");
                    if (field == null) {
                        throw new ConfigurationException("The field attribute of a controller is mandatory");
                    }

                    String v = controller.getAttribute("value");
                    boolean value = !(v != null && v.equalsIgnoreCase("false"));
                    String s = controller.getAttribute("specification");
                    if (s == null) {
                        s = "ALL";
                    }
                    svc.setController(field, value, s);

                    getInstanceManager().register(new FieldMetadata(field, "boolean"), this);
                }
            }

            if (checkProvidedService(svc)) {
                m_providedServices.add(svc);
View Full Code Here

                // Check type if not already set
                if (type == null) {
                    if (field == null) {
                        throw new ConfigurationException("The property " + name + " has neither type nor field.");
                    }
                    FieldMetadata fieldMeta = manipulation.getField(field);
                    if (fieldMeta == null) {
                        throw new ConfigurationException("A declared property was not found in the implementation class : " + field);
                    }
                    type = fieldMeta.getFieldType();
                    props[j].addAttribute(new Attribute("type", type));
                }

                // Is the property set to immutable
                boolean immutable = false;
View Full Code Here

            throw new ConfigurationException("The handler " + NAMESPACE + ":" + NAME + " cannot be declared several times");
        }

        String field = elements[0].getAttribute(FIELD_ATTRIBUTE);
        if (field != null) {
            FieldMetadata meta = getPojoMetadata().getField(field);
            if (meta == null) {
                throw new ConfigurationException("The transaction field does not exist in the pojo class : " + field);
            }
            if (! meta.getFieldType().equals(Transaction.class.getName())) {
                throw new ConfigurationException("The transaction field type must be " + Transaction.class.getName());
            }
            // Register the interceptor
            getInstanceManager().register(meta, this);
View Full Code Here

                String name = publisherMetadata.getName();
                info(LOG_PREFIX + "Checking publisher " + name);

                // Check field existence and type
                String field = publisherMetadata.getField();
                FieldMetadata fieldMetadata = getPojoMetadata()
                        .getField(publisherMetadata.getField(),
                                Publisher.class.getName());
                if (fieldMetadata == null) {
                    throw new ConfigurationException(
                            "Field not found in the component : "
View Full Code Here

                        .put(publisherMetadata.getField(), publisher);

                // Register the callback that return the publisher
                // reference when the specified field is read by the
                // POJO.
                FieldMetadata fieldMetadata = getPojoMetadata()
                        .getField(publisherMetadata.getField(),
                                Publisher.class.getName());
                m_manager.register(fieldMetadata, this);

            }
View Full Code Here

    AtomicImplementationDeclaration primitive = (AtomicImplementationDeclaration) declaration;
    for (PropertyDefinition definition : primitive.getPropertyDefinitions()) {

      if (definition.getField() != null) {
        FieldMetadata field = getPojoMetadata().getField(
            definition.getField());
        if (field == null)
          throw new ConfigurationException("Invalid property definition "  + definition.getName()+ ": the specified field does not exist");

      }
View Full Code Here

    AtomicImplementationDeclaration primitive = (AtomicImplementationDeclaration) declaration;
    for (PropertyDefinition definition : primitive.getPropertyDefinitions()) {

      if (definition.getField() != null) {
        FieldMetadata field = getPojoMetadata().getField(definition.getField());
        getInstanceManager().register(field,this);
      }

      if (definition.getCallback() != null) {
        getInstanceManager().addCallback(new PropertyCallback(getInstanceManager(), definition));
View Full Code Here

      if (definition.getInjected() == InjectedPropertyPolicy.EXTERNAL)
        continue;
     
      if (definition.getField() != null) {
        FieldMetadata field = getPojoMetadata().getField(definition.getField());
       
        Object fieldValue  = getInstanceManager().getFieldValue(field.getFieldName());
       
        if (definition.getInjected() == InjectedPropertyPolicy.INTERNAL)
          onSet(getInstanceManager().getPojoObject(), field.getFieldName(), fieldValue);
       
        if (definition.getInjected() == InjectedPropertyPolicy.BOTH) {
          Object apamValue  = component.getPropertyObject(definition.getName());
         
          if (apamValue == null)
            onSet(getInstanceManager().getPojoObject(), field.getFieldName(), fieldValue);
        }

      }

    }   
View Full Code Here

    }

    /*
     * Get iPojo metadata
     */
    FieldMetadata fieldIPojoMetadata = null;
    if ((pojoMetadata != null) && (pojoMetadata.getField(fieldName) != null)) {
      fieldIPojoMetadata = pojoMetadata.getField(fieldName);
    }

    if (fieldIPojoMetadata != null) {
      return fieldIPojoMetadata.getFieldType();
    }

    throw new NoSuchFieldException("unavailable field " + fieldName);

    }
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.parser.FieldMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.