if (componentProperty != component.getProperty(componentProperty.getName())){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "DuplicateComponentPropertyName", component.getName(), componentProperty.getName()); Property property = component.getImplementation().getProperty(componentProperty.getName()); componentProperty.setProperty(property); if (componentProperty.getXSDElement() == null){ componentProperty.setXSDElement(property.getXSDElement()); if (componentProperty.getXSDType() == null){ componentProperty.setXSDType(property.getXSDType()); "PropertyNotFound", component.getName(), componentProperty.getName());
QName type = property.getXSDType(); if( type != null ) { if( mapper.isSimpleXSDType( type ) ) { String valueText = getPropertyValueText( property.getValue() ); Element literalElement = bpelDOM.createElementNS(NS_URI, "literal"); literalElement.setTextContent(valueText); Element toElement = bpelDOM.createElementNS(NS_URI, "to"); Attr variableAttribute = bpelDOM.createAttribute("variable"); variableAttribute.setValue( property.getName() ); toElement.setAttributeNode( variableAttribute ); Element copyElement = bpelDOM.createElementNS(NS_URI, "copy");
private void reconcileComponentPropertyWithComponentType(Component component, ComponentProperty componentProperty, Monitor monitor) { Property componentTypeProperty = componentProperty.getProperty(); if (componentTypeProperty != null) { if (!componentTypeProperty.isMustSupply() && componentProperty.isMustSupply()) { Monitor.error(monitor, this, "PropertyMustSupplyIncompatible", component.getName(), componentProperty.getName()); if (!componentProperty.isMustSupply()) componentProperty.setMustSupply(componentTypeProperty.isMustSupply()); componentProperty.setValue(componentTypeProperty.getValue()); componentTypeProperty.setValue(componentProperty.getValue()); if (!componentTypeProperty.isMany() && componentProperty.isMany()) { Monitor.error(monitor, this, "PropertyOverrideManyAttribute", component.getName(), componentProperty.getName()); componentProperty.setMany(componentTypeProperty.isMany()); if (componentProperty.getXSDType() == null) {
writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()), new XAttr(MUST_SUPPLY, property.isMustSupply()), new XAttr(MANY, property.isMany()), new XAttr(TYPE, property.getXSDType()), new XAttr(ELEMENT, property.getXSDElement()), new XAttr(SOURCE, property.getSource()), new XAttr(FILE, property.getFile()), policyProcessor.writePolicies(property)); writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer); for (Object extension : property.getExtensions()) { extensionProcessor.write(extension, writer, context);
ComponentProperty componentProperty, Monitor monitor) { String source = componentProperty.getSource(); "PropertySourceNotFound", source, componentProperty.getName(), component.getName()); } else { componentProperty.getSourceXPathExpression(), documentBuilderFactory); componentProperty.setValue(node); if(componentProperty.getXSDElement() == null){ componentProperty.setXSDElement(sourceProp.getXSDElement()); if(componentProperty.getXSDType() == null){ componentProperty.setXSDType(sourceProp.getXSDType()); "PropertyXpathExpressionReturnedNull", component.getName(), componentProperty.getName(), componentProperty.getSource()); source, componentProperty.getName(), component.getName(), ex);
QName propertyXSDType = componentProperty.getXSDType(); QName propertyElementType = componentProperty.getXSDElement(); Document doc = (Document)componentProperty.getValue(); Node source = (doc == null) ? null : doc.getDocumentElement().getFirstChild(); DataType<XMLType> sourceDataType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, componentProperty.getXSDType())); DataType<XMLType> targetDataType = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, Object.class, new XMLType(null, componentProperty.getXSDType())); try { mediator.mediate(source, sourceDataType, targetDataType, null); Messages.ASSEMBLY_VALIDATION, "PropertyValueDoesNotMatchSimpleType", componentProperty.getName(), component.getName(), componentProperty.getXSDType().toString()); XSDefinition xsdDefinition = (XSDefinition)componentProperty.getXSDDefinition(); if (componentProperty.getXSDType().getNamespaceURI().equals(Constants.SCA11_NS)){ "xmlns:__tmp=\"" + componentProperty.getXSDType().getNamespaceURI() + "\" "+ "targetNamespace=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" " + "elementFormDefault=\"qualified\">" + "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" "+
if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) { Monitor.error(monitor, this, if (componentProperty.isMustSupply() && !isPropertyValueSet(componentProperty)) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "PropertyMustSupplyNull", component.getName(), componentProperty.getName()); if (!componentProperty.isMany() && isPropertyManyValued(componentProperty)){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "PropertyHasManyValues", component.getName(), componentProperty.getName());
public ComponentProperty getProperty(String name) { for (ComponentProperty property : getProperties()) { if (property.getName().equals(name)) { return property; } } return null; }
/** * Convert property value to String * @param property * @return */ private static String getPropertyValue(ComponentProperty property) { Document doc = (Document)property.getValue(); Element rootElement = doc.getDocumentElement(); String value = null; //FIXME : Provide support for isMany and other property types if (rootElement.getChildNodes().getLength() > 0) { value = rootElement.getChildNodes().item(0).getTextContent(); } return value; }
private <B> void validateTypes(ComponentProperty property, Class<B> type) { // JAXB seems to do some strange things with conversions, so // we can't rely on the databinding conversion from Node->Java to catch // incompatible types. DataType prop1 = property.getProperty().getDataType(); if ( (prop1 != null) && (type.isAssignableFrom(prop1.getPhysical())) ) { return; } else if ( simpleTypeMapper.getXMLType(type) != null ) { if ( simpleTypeMapper.getXMLType(type).getQName().equals(property.getXSDType())) return; } else if ( isSimpleType(property) ) { if ( type.isAssignableFrom(simpleTypeMapper.getJavaType(property.getXSDType()))) return; } throw new IllegalArgumentException("Property type " + prop1.getPhysical().getName() + " is not compatible with " + type.getName()); }
if (componentProperty.getFile() != null) { Artifact artifact = contributionFactory.createArtifact(); artifact.setURI(componentProperty.getFile()); artifact = resolver.resolveModel(Artifact.class, artifact, context); if (artifact.getLocation() != null) { componentProperty.setFile(artifact.getLocation());
private void reconcileComponentPropertyWithComponentType(Component component, ComponentProperty componentProperty, Monitor monitor) { Property componentTypeProperty = componentProperty.getProperty(); if (componentTypeProperty != null) { if (!componentTypeProperty.isMustSupply() && componentProperty.isMustSupply()) { Monitor.error(monitor, this, "PropertyMustSupplyIncompatible", component.getName(), componentProperty.getName()); if (!componentProperty.isMustSupply()) componentProperty.setMustSupply(componentTypeProperty.isMustSupply()); componentProperty.setValue(componentTypeProperty.getValue()); componentTypeProperty.setValue(componentProperty.getValue()); if (!componentTypeProperty.isMany() && componentProperty.isMany()) { Monitor.error(monitor, this, "PropertyOverrideManyAttribute", component.getName(), componentProperty.getName()); componentProperty.setMany(componentTypeProperty.isMany()); if (componentProperty.getXSDType() == null) {
writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()), new XAttr(MUST_SUPPLY, property.isMustSupply()), new XAttr(MANY, property.isMany()), new XAttr(TYPE, property.getXSDType()), new XAttr(ELEMENT, property.getXSDElement()), new XAttr(SOURCE, property.getSource()), new XAttr(FILE, property.getFile()), policyProcessor.writePolicies(property)); writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer); for (Object extension : property.getExtensions()) { extensionProcessor.write(extension, writer, context);
ComponentProperty componentProperty, Monitor monitor) { String source = componentProperty.getSource(); "PropertySourceNotFound", source, componentProperty.getName(), component.getName()); } else { componentProperty.getSourceXPathExpression(), documentBuilderFactory); componentProperty.setValue(node); if(componentProperty.getXSDElement() == null){ componentProperty.setXSDElement(sourceProp.getXSDElement()); if(componentProperty.getXSDType() == null){ componentProperty.setXSDType(sourceProp.getXSDType()); "PropertyXpathExpressionReturnedNull", component.getName(), componentProperty.getName(), componentProperty.getSource()); source, componentProperty.getName(), component.getName(), ex);
QName propertyXSDType = componentProperty.getXSDType(); QName propertyElementType = componentProperty.getXSDElement(); Document doc = (Document)componentProperty.getValue(); Node source = (doc == null) ? null : doc.getDocumentElement().getFirstChild(); DataType<XMLType> sourceDataType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, componentProperty.getXSDType())); DataType<XMLType> targetDataType = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, Object.class, new XMLType(null, componentProperty.getXSDType())); try { mediator.mediate(source, sourceDataType, targetDataType, null); Messages.ASSEMBLY_VALIDATION, "PropertyValueDoesNotMatchSimpleType", componentProperty.getName(), component.getName(), componentProperty.getXSDType().toString()); XSDefinition xsdDefinition = (XSDefinition)componentProperty.getXSDDefinition(); if (componentProperty.getXSDType().getNamespaceURI().equals(Constants.SCA11_NS)){ "xmlns:__tmp=\"" + componentProperty.getXSDType().getNamespaceURI() + "\" "+ "targetNamespace=\"http://docs.oasis-open.org/ns/opencsa/sca/200912\" " + "elementFormDefault=\"qualified\">" + "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" "+
if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) { Monitor.error(monitor, this, if (componentProperty.isMustSupply() && !isPropertyValueSet(componentProperty)) { Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "PropertyMustSupplyNull", component.getName(), componentProperty.getName()); if (!componentProperty.isMany() && isPropertyManyValued(componentProperty)){ Monitor.error(monitor, this, Messages.ASSEMBLY_VALIDATION, "PropertyHasManyValues", component.getName(), componentProperty.getName());
public ComponentProperty getProperty(String name) { for (ComponentProperty property : getProperties()) { if (property.getName().equals(name)) { return property; } } return null; }