public Property load(XMLStreamReader reader, IntrospectionContext ctx) throws XMLStreamException { validateAttributes(reader, ctx); String name = reader.getAttributeValue(null, NAME); boolean many = Boolean.parseBoolean(reader.getAttributeValue(null, MANY)); boolean mustSupply = Boolean.parseBoolean(reader.getAttributeValue(null, MUST_SUPPLY)); Document value = helper.loadValue(reader); Property property = new Property(); property.setRequired(mustSupply); property.setName(name); property.setXmlType(XS_STRING); property.setMany(many); property.setDefaultValue(value); return property; }
public RequiredPropertyNotProvided(Property property, String componentName, XMLStreamReader reader) { super("Component " + componentName + " has a required property " + property.getName() + " that is not set", reader); this.componentName = componentName; }
private Property createDefinition(String name, boolean required, Type type, TypeMapping typeMapping) { Property property = new Property(name); property.setRequired(required); MultiplicityType multiplicityType = helper.introspectMultiplicity(type, typeMapping); property.setMany(MultiplicityType.COLLECTION == multiplicityType || MultiplicityType.DICTIONARY == multiplicityType); return property; }
private void addProperty(InjectingComponentType componentType, TypeMapping typeMapping, String name, Type type, InjectionSite site) { Property property = new Property(name); MultiplicityType multiplicityType = helper.introspectMultiplicity(type, typeMapping); property.setMany(MultiplicityType.COLLECTION == multiplicityType || MultiplicityType.DICTIONARY == multiplicityType); componentType.add(property, site); }
private void includeProperties(Composite composite, LogicalCompositeComponent domain, InstantiationContext context) { for (Property property : composite.getProperties().values()) { String name = property.getName(); if (domain.getAllProperties().containsKey(name)) { DuplicateProperty error = new DuplicateProperty(name, domain); context.addError(error); } else { Document value = property.getDefaultValue(); boolean many = property.isMany(); QName type = property.getType(); LogicalProperty logicalProperty = new LogicalProperty(name, value, many, type, domain); domain.setProperties(logicalProperty); } } }
Property property = new Property(name); property.setRequired(true); property.setType(XSD_INT); } else if (Boolean.class.getName().equals(propertyType)) { property.setType(XSD_BOOLEAN); } else { property.setType(XSD_STRING);
private void validateRequiredProperties(ComponentDefinition<? extends Implementation<?>> definition, XMLStreamReader reader, IntrospectionContext context) { AbstractComponentType<?, ?, ?, ?> type = definition.getImplementation().getComponentType(); Map<String, ? extends Property> properties = type.getProperties(); Map<String, PropertyValue> values = definition.getPropertyValues(); for (Property property : properties.values()) { if (property.isRequired() && !values.containsKey(property.getName())) { RequiredPropertyNotProvided failure = new RequiredPropertyNotProvided(property, definition.getName(), reader); context.addError(failure); } } }
private void processPropertyValues(LogicalComponent<?> component, SpringComponentDefinition physical) { for (LogicalProperty property : component.getAllProperties().values()) { Document document = property.getValue(); if (document != null) { String name = property.getName(); boolean many = property.isMany(); ComponentType componentType = component.getDefinition().getImplementation().getComponentType(); QName type = componentType.getProperties().get(property.getName()).getType(); PhysicalPropertyDefinition definition = new PhysicalPropertyDefinition(name, document, many, type); physical.setPropertyDefinition(definition); } } }
String name = property.getName(); PropertyValue propertyValue = propertyValues.get(name); if (propertyValue == null) { value = property.getDefaultValue(); } else { value = loadValueFromFile(property.getName(), propertyValue.getFile(), component, context); } else if (propertyValue.getSource() != null) { if (property.isRequired() && value == null) { } else if (!property.isRequired() && value == null) { boolean many = property.isMany(); LogicalProperty logicalProperty; QName type = property.getType(); if (type == null) { logicalProperty = new LogicalProperty(name, value, many, component);
private void generatePropertyInjectionMapping(Property property, Map<String, Map<String, InjectionSite>> mappings) { Map<String, InjectionSite> mapping = mappings.get(property.getName()); if (mapping == null) { mapping = new HashMap<String, InjectionSite>(); mappings.put(property.getName(), mapping); } // inject the property into the session context // we don't need to do the type mappings from schema to Java so set Object as the type WebContextInjectionSite site = new WebContextInjectionSite(Object.class.getName(), SERVLET_CONTEXT); mapping.put(SESSION_CONTEXT_SITE, site); }
private void handleProperty(Composite type, XMLStreamReader reader, IntrospectionContext childContext) throws XMLStreamException, UnrecognizedElementException { Property property = propertyLoader.load(reader, childContext); if (property == null) { // errror encountered loading the property return; } String key = property.getName(); if (type.getProperties().containsKey(key)) { DuplicateProperty failure = new DuplicateProperty(key, reader); childContext.addError(failure); } else { type.add(property); } }