/** * Write policies associated with an operation * @param subject * @param operation * @return */ XAttr writePolicies(Object subject, Operation operation) { List<XAttr> attrs =new ArrayList<XAttr>(); attrs.add(writeIntents(subject, operation)); attrs.add(writePolicySets(subject, operation)); return new XAttr(null, attrs); }
/** * Write policies associated with an operation * @param subject * @param operation * @return */ XAttr writePolicies(Object subject, Operation operation) { List<XAttr> attrs =new ArrayList<XAttr>(); attrs.add(writeIntents(subject, operation)); attrs.add(writePolicySets(subject, operation)); return new XAttr(null, attrs); }
public void write(T bean, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { try { // Write the bean properties as attributes List<XAttr> attrs = new ArrayList<XAttr>(); for (Map.Entry<String, Method> entry: getterMethods.entrySet()) { if (entry.getValue().getReturnType() == String.class) { String value = (String)entry.getValue().invoke(bean); attrs.add(new XAttr(entry.getKey(), value)); } } // Write element writeStart(writer, artifactType.getNamespaceURI(), artifactType.getLocalPart(), policyProcessor.writePolicies(bean), new XAttr(null, attrs)); writeEnd(writer); } catch (Exception e) { ContributionWriteException ce = new ContributionWriteException(e); error(context.getMonitor(), "ContributionWriteException", writer, ce); throw ce; } }
public void write(T bean, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { try { // Write the bean properties as attributes List<XAttr> attrs = new ArrayList<XAttr>(); for (Map.Entry<String, Method> entry: getterMethods.entrySet()) { if (entry.getValue().getReturnType() == String.class) { String value = (String)entry.getValue().invoke(bean); attrs.add(new XAttr(entry.getKey(), value)); } } // Write element writeStart(writer, artifactType.getNamespaceURI(), artifactType.getLocalPart(), policyProcessor.writePolicies(bean), new XAttr(null, attrs)); writeEnd(writer); } catch (Exception e) { ContributionWriteException ce = new ContributionWriteException(e); error(context.getMonitor(), "ContributionWriteException", writer, ce); throw ce; } }
public void write(ContributionMetadata contribution, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { // Write <contribution> writeStartDocument(writer, CONTRIBUTION_QNAME.getNamespaceURI(), CONTRIBUTION_QNAME.getLocalPart()); writeExtendedAttributes(writer, contribution, attributeProcessor, context); // Write <import> for (Import imp : contribution.getImports()) { extensionProcessor.write(imp, writer, context); } // Write <export> for (Export export : contribution.getExports()) { extensionProcessor.write(export, writer, context); } // Write <deployable> for (Composite deployable : contribution.getDeployables()) { writeStart(writer, DEPLOYABLE_QNAME.getNamespaceURI(), DEPLOYABLE_QNAME.getLocalPart(), new XAttr("composite", deployable.getName())); writeEnd(writer); } writeEndDocument(writer); }
public void write(ContributionMetadata contribution, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { // Write <contribution> writeStartDocument(writer, CONTRIBUTION_QNAME.getNamespaceURI(), CONTRIBUTION_QNAME.getLocalPart()); writeExtendedAttributes(writer, contribution, attributeProcessor, context); // Write <import> for (Import imp : contribution.getImports()) { extensionProcessor.write(imp, writer, context); } // Write <export> for (Export export : contribution.getExports()) { extensionProcessor.write(export, writer, context); } // Write <deployable> for (Composite deployable : contribution.getDeployables()) { writeStart(writer, DEPLOYABLE_QNAME.getNamespaceURI(), DEPLOYABLE_QNAME.getLocalPart(), new XAttr("composite", deployable.getName())); writeEnd(writer); } writeEndDocument(writer); }
public void write(Definitions definitions, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { writeStartDocument(writer, SCA11_NS, DEFINITIONS, new XAttr(TARGET_NAMESPACE, definitions.getTargetNamespace())); for (Intent policyIntent : definitions.getIntents()) { extensionProcessor.write(policyIntent, writer, context); } for (PolicySet policySet : definitions.getPolicySets()) { extensionProcessor.write(policySet, writer, context); } for (Binding binding : definitions.getBindings()) { extensionProcessor.write(binding, writer, context); } for (BindingType bindingType : definitions.getBindingTypes()) { extensionProcessor.write(bindingType, writer, context); } for (ImplementationType implType : definitions.getImplementationTypes()) { extensionProcessor.write(implType, writer, context); } writeEndDocument(writer); }
protected XAttr writeMultiplicity(AbstractReference reference) { Multiplicity multiplicity = reference.getMultiplicity(); if (multiplicity != null) { String value = null; if (Multiplicity.ZERO_ONE.equals(multiplicity)) { value = ZERO_ONE; } else if (Multiplicity.ONE_N.equals(multiplicity)) { value = ONE_N; } else if (Multiplicity.ZERO_N.equals(multiplicity)) { value = ZERO_N; } else if (Multiplicity.ONE_ONE.equals(multiplicity)) { value = ONE_ONE; return null; } return new XAttr(MULTIPLICITY, value); } return null; }
public void write(Definitions definitions, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { writeStartDocument(writer, SCA11_NS, DEFINITIONS, new XAttr(TARGET_NAMESPACE, definitions.getTargetNamespace())); for (Intent policyIntent : definitions.getIntents()) { extensionProcessor.write(policyIntent, writer, context); } for (PolicySet policySet : definitions.getPolicySets()) { extensionProcessor.write(policySet, writer, context); } for (Binding binding : definitions.getBindings()) { extensionProcessor.write(binding, writer, context); } for (BindingType bindingType : definitions.getBindingTypes()) { extensionProcessor.write(bindingType, writer, context); } for (ImplementationType implType : definitions.getImplementationTypes()) { extensionProcessor.write(implType, writer, context); } writeEndDocument(writer); }
public void write(SCAConfig definitions, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { writeStartDocument(writer, SCA_CONFIG_QNAME.getNamespaceURI(), SCA_CONFIG_QNAME.getLocalPart(), new XAttr("targetNamespace", definitions.getTargetNamespace())); for (Binding binding : definitions.getBindings()) { processor.write(binding, writer, context); } for (Intent policyIntent : definitions.getIntents()) { processor.write(policyIntent, writer, context); } for (PolicySet policySet : definitions.getPolicySets()) { processor.write(policySet, writer, context); } writeEndDocument(writer); }
protected XAttr writeMultiplicity(AbstractReference reference) { Multiplicity multiplicity = reference.getMultiplicity(); if (multiplicity != null) { String value = null; if (Multiplicity.ZERO_ONE.equals(multiplicity)) { value = ZERO_ONE; } else if (Multiplicity.ONE_N.equals(multiplicity)) { value = ONE_N; } else if (Multiplicity.ZERO_N.equals(multiplicity)) { value = ZERO_N; } else if (Multiplicity.ONE_ONE.equals(multiplicity)) { value = ONE_ONE; return null; } return new XAttr(MULTIPLICITY, value); } return null; }
/** * Write policy sets associated with an operation. * @param subject * @param operation */ private XAttr writePolicySets(Object subject, Operation operation) { if (!(subject instanceof PolicySubject)) { return null; } PolicySubject policySetAttachPoint = (PolicySubject)subject; List<QName> qnames = new ArrayList<QName>(); for (PolicySet policySet: policySetAttachPoint.getPolicySets()) { qnames.add(policySet.getName()); } return new XAttr(Constants.POLICY_SETS, qnames); }
/** * Write policy sets associated with an operation. * @param subject * @param operation */ private XAttr writePolicySets(Object subject, Operation operation) { if (!(subject instanceof PolicySubject)) { return null; } PolicySubject policySetAttachPoint = (PolicySubject)subject; List<QName> qnames = new ArrayList<QName>(); for (PolicySet policySet: policySetAttachPoint.getPolicySets()) { qnames.add(policySet.getName()); } return new XAttr(Constants.POLICY_SETS, qnames); }
/** * Write policy intents associated with an operation. * @param subject * @param operation */ private XAttr writeIntents(Object subject, Operation operation) { if (!(subject instanceof PolicySubject)) { return null; } PolicySubject intentAttachPoint = (PolicySubject)subject; List<QName> qnames = new ArrayList<QName>(); for (Intent intent: intentAttachPoint.getRequiredIntents()) { qnames.add(intent.getName()); } return new XAttr(Constants.REQUIRES, qnames); }
/** * Write policy intents associated with an operation. * @param subject * @param operation */ private XAttr writeIntents(Object subject, Operation operation) { if (!(subject instanceof PolicySubject)) { return null; } PolicySubject intentAttachPoint = (PolicySubject)subject; List<QName> qnames = new ArrayList<QName>(); for (Intent intent: intentAttachPoint.getRequiredIntents()) { qnames.add(intent.getName()); } return new XAttr(Constants.REQUIRES, qnames); }
public void write(JAXRSImplementation implementation, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { // Write <implementation.jaxrs> writeStart(writer, IMPLEMENTATION_JAXRS.getNamespaceURI(), IMPLEMENTATION_JAXRS.getLocalPart(), new XAttr("application", implementation.getApplication())); writeEnd(writer); } }
public void write(WebImplementation implementation, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException { // Write <implementation.web> writeStart(writer, IMPLEMENTATION_WEB.getNamespaceURI(), IMPLEMENTATION_WEB.getLocalPart(), new XAttr("web-uri", implementation.getWebURI())); writeEnd(writer); } }
/** * Write a list of targets into an attribute * @param reference * @return */ protected XAttr writeTargets(Reference reference) { List<String> targets = new ArrayList<String>(); for (Service target : reference.getTargets()) { targets.add(target.getName()); } return new XAttr(TARGET, targets); }
public void write(final PythonImplementation impl, final XMLStreamWriter w, final ProcessorContext ctx) throws ContributionWriteException, XMLStreamException { writeStart(w, QN.getNamespaceURI(), QN.getLocalPart(), new XAttr("script", impl.getScript())); writeEnd(w); } }
/** * Write a list of targets into an attribute * @param reference * @return */ protected XAttr writeTargets(Reference reference) { List<String> targets = new ArrayList<String>(); for (Service target : reference.getTargets()) { targets.add(target.getName()); } return new XAttr(TARGET, targets); }