Search in sources :

Example 6 with XmlWriter

use of org.apache.aries.blueprint.plugin.spi.XmlWriter in project aries by apache.

the class OsgiServiceProviderHandler method handleAnnotation.

private void handleAnnotation(AnnotatedElement annotatedElement, final String id, ContextEnricher contextEnricher) {
    final OsgiServiceProvider serviceProvider = annotatedElement.getAnnotation(OsgiServiceProvider.class);
    Properties properties = annotatedElement.getAnnotation(Properties.class);
    final List<String> interfaceNames = extractServiceInterfaces(serviceProvider);
    final List<ServiceProperty> serviceProperties = extractProperties(properties);
    contextEnricher.addBlueprintContentWriter("OsgiServiceProvider/" + annotatedElement + "/" + id, new XmlWriter() {

        @Override
        public void write(XMLStreamWriter writer) throws XMLStreamException {
            writeService(writer, serviceProperties, interfaceNames, id);
        }
    });
}
Also used : XMLStreamException(javax.xml.stream.XMLStreamException) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) OsgiServiceProvider(org.ops4j.pax.cdi.api.OsgiServiceProvider) Properties(org.ops4j.pax.cdi.api.Properties) XmlWriter(org.apache.aries.blueprint.plugin.spi.XmlWriter)

Example 7 with XmlWriter

use of org.apache.aries.blueprint.plugin.spi.XmlWriter in project aries by apache.

the class ConfigPropertiesHandler method enrichContext.

private void enrichContext(ContextEnricher contextEnricher, final String pid, final boolean update, final String id) {
    contextEnricher.addBean(id, Properties.class);
    contextEnricher.addBlueprintContentWriter("properties/" + id, new XmlWriter() {

        @Override
        public void write(XMLStreamWriter writer) throws XMLStreamException {
            writer.writeEmptyElement("cm-properties");
            writer.writeDefaultNamespace("http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0");
            writer.writeAttribute("id", id);
            writer.writeAttribute("persistent-id", pid);
            writer.writeAttribute("update", String.valueOf(update));
        }
    });
}
Also used : XMLStreamException(javax.xml.stream.XMLStreamException) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) XmlWriter(org.apache.aries.blueprint.plugin.spi.XmlWriter)

Aggregations

XMLStreamException (javax.xml.stream.XMLStreamException)7 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)7 XmlWriter (org.apache.aries.blueprint.plugin.spi.XmlWriter)7 Field (java.lang.reflect.Field)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Method (java.lang.reflect.Method)1 PersistenceContext (javax.persistence.PersistenceContext)1 PersistenceUnit (javax.persistence.PersistenceUnit)1 OsgiServiceProvider (org.ops4j.pax.cdi.api.OsgiServiceProvider)1 Properties (org.ops4j.pax.cdi.api.Properties)1