aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1636323 - in /aries/trunk/blueprint: ./ blueprint-maven-plugin/ blueprint-maven-plugin/src/ blueprint-maven-plugin/src/main/ blueprint-maven-plugin/src/main/java/ blueprint-maven-plugin/src/main/java/org/ blueprint-maven-plugin/src/main/ja...
Date Mon, 03 Nov 2014 11:35:41 GMT
Author: cschneider
Date: Mon Nov  3 11:35:40 2014
New Revision: 1636323

URL: http://svn.apache.org/r1636323
Log:
ARIES-1269 Add blueprint maven plugin

Added:
    aries/trunk/blueprint/blueprint-maven-plugin/
    aries/trunk/blueprint/blueprint-maven-plugin/pom.xml
    aries/trunk/blueprint/blueprint-maven-plugin/src/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceProviderWriter.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Matcher.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceBean.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/TransactionalDef.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/ContextTest.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/PropertyTest.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/TestBeanForRef.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceA.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl1.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl2.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceB.java
    aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceReferences.java
Modified:
    aries/trunk/blueprint/pom.xml

Added: aries/trunk/blueprint/blueprint-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/pom.xml?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/pom.xml (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/pom.xml Mon Nov  3 11:35:40 2014
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.aries</groupId>
+        <artifactId>parent</artifactId>
+        <version>2.0.0</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <groupId>org.apache.aries.blueprint</groupId>
+    <artifactId>blueprint-maven-plugin</artifactId>
+    <packaging>maven-plugin</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <name>Apache Aries Blueprint Maven Plugin</name>
+    <description>
+        Maven plugin to create blueprint files from annotations
+    </description>
+
+    <properties>
+        <maven.version>3.0.5</maven.version>
+        <aether.version>1.11</aether.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <target>1.7</target>
+                    <source>1.7</source>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
+            <version>1</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.transaction</groupId>
+            <artifactId>javax.transaction-api</artifactId>
+            <version>1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.persistence</groupId>
+            <artifactId>persistence-api</artifactId>
+            <version>1.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.cdi</groupId>
+            <artifactId>pax-cdi-api</artifactId>
+            <version>0.8.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>${maven.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.sonatype.aether</groupId>
+            <artifactId>aether-api</artifactId>
+            <version>${aether.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.sonatype.aether</groupId>
+            <artifactId>aether-util</artifactId>
+            <version>${aether.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+            <version>${maven.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-core</artifactId>
+            <version>${maven.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-compat</artifactId>
+            <version>${maven.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.wagon</groupId>
+            <artifactId>wagon-http-lightweight</artifactId>
+            <version>2.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-jdk14</artifactId>
+            <version>1.7.7</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven.shared</groupId>
+            <artifactId>maven-filtering</artifactId>
+            <version>1.0-beta-4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-utils</artifactId>
+            <version>3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xbean</groupId>
+            <artifactId>xbean-finder-shaded</artifactId>
+            <version>3.18</version>
+        </dependency>
+
+        <!-- For the spring annotations -->
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>3.1.4.RELEASE</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>spring-aop</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-core</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-expression</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-asm</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-tx</artifactId>
+            <version>3.1.4.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <version>2.9</version>
+            </plugin>
+        </plugins>
+    </reporting>
+
+</project>

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin;
+
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Singleton;
+
+import org.apache.xbean.finder.ClassFinder;
+import org.springframework.stereotype.Component;
+
+public class FilteredClassFinder {
+    
+    @SuppressWarnings("unchecked")
+    public static Set<Class<?>> findClasses(ClassFinder finder, Collection<String> packageNames) {
+        return findClasses(finder, packageNames, new Class[]{Singleton.class, Component.class});
+    }
+
+    public static Set<Class<?>> findClasses(ClassFinder finder, Collection<String> packageNames, Class<? extends Annotation>[] annotations) {
+        Set<Class<?>> rawClasses = new HashSet<Class<?>>();
+        for (Class<? extends Annotation> annotation : annotations) {
+            rawClasses.addAll(finder.findAnnotatedClasses(annotation));
+        }
+        return filterByBasePackages(rawClasses, packageNames);
+    }
+    
+    private static Set<Class<?>> filterByBasePackages(Set<Class<?>> rawClasses, Collection<String> packageNames) {
+        Set<Class<?>> filteredClasses = new HashSet<Class<?>>();
+        for (Class<?> clazz : rawClasses) {
+            for (String packageName : packageNames) {
+                if (clazz.getPackage().getName().startsWith(packageName)) {
+                    filteredClasses.add(clazz);
+                    continue;
+                }
+            }
+        }
+        //System.out.println("Raw: " + rawClasses);
+        //System.out.println("Filtered: " + beanClasses);
+        return filteredClasses;
+    }
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.aries.blueprint.plugin.model.Context;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.xbean.finder.ClassFinder;
+
+/**
+ * Generates blueprint from spring annotations
+ * @goal blueprint-generate
+ * @phase process-classes
+ * @requiresDependencyResolution compile
+ * @inheritByDefault false
+ * @description Generates blueprint file from spring annotations @Component, @Autowire and @Value
+ */
+public class GenerateMojo extends AbstractMojo {
+
+    /**
+     * The maven project.
+     *
+     * @parameter default-value="${project}"
+     * @required
+     */
+    protected MavenProject project;
+
+    /**
+     * @parameter
+     * @required
+     */
+    protected List<String> scanPaths;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        try {
+            String buildDir = project.getBuild().getDirectory();
+            String generatedDir = buildDir + "/generated-resources";
+            Resource resource = new Resource();
+            resource.setDirectory(generatedDir);
+            project.addResource(resource);
+            ClassFinder finder = createProjectScopeFinder();
+            
+            File file = new File(generatedDir, "OSGI-INF/blueprint/autowire.xml");
+            file.getParentFile().mkdirs();
+            System.out.println("Generating blueprint to " + file);
+            Set<Class<?>> classes = FilteredClassFinder.findClasses(finder, scanPaths);
+            Context context = new Context(classes);
+            context.resolve();
+            new Generator(context, new FileOutputStream(file)).generate();
+        } catch (Exception e) {
+            throw new MojoExecutionException("Error building commands help", e);
+        }
+    }
+
+    private ClassFinder createProjectScopeFinder() throws MalformedURLException {
+        List<URL> urls = new ArrayList<URL>();
+
+        urls.add( new File(project.getBuild().getOutputDirectory()).toURI().toURL() );
+        for ( Object artifactO : project.getArtifacts() ) {
+            Artifact artifact = (Artifact)artifactO;
+            File file = artifact.getFile();
+            if ( file != null ) {
+                urls.add( file.toURI().toURL() );
+            }
+        }
+        ClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
+        return new ClassFinder(loader, urls);
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,160 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin;
+
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+
+import javax.persistence.PersistenceUnit;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.aries.blueprint.plugin.model.Bean;
+import org.apache.aries.blueprint.plugin.model.Context;
+import org.apache.aries.blueprint.plugin.model.OsgiServiceBean;
+import org.apache.aries.blueprint.plugin.model.Property;
+import org.apache.aries.blueprint.plugin.model.PropertyWriter;
+import org.apache.aries.blueprint.plugin.model.TransactionalDef;
+
+public class Generator implements PropertyWriter {
+    private static final String NS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
+    private static final String NS_EXT = "http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";
+    private static final String NS_JPA = "http://aries.apache.org/xmlns/jpa/v1.1.0";
+    private static final String NS_TX = "http://aries.apache.org/xmlns/transactions/v1.1.0";
+
+    private Context context;
+    private XMLStreamWriter writer;
+
+    public Generator(Context context, OutputStream os) throws XMLStreamException {
+        this.context = context;
+        
+        XMLOutputFactory factory = XMLOutputFactory.newInstance();
+        writer = factory.createXMLStreamWriter(os);
+    }
+
+    public void generate() {
+        try {
+            writer.writeStartDocument();
+            writer.writeCharacters("\n");
+            writeBlueprint();
+            for (Bean bean : context.getBeans()) {
+                writeBeanStart(bean);
+                bean.writeProperties(this);
+                writer.writeEndElement();
+                writer.writeCharacters("\n");
+            }
+            
+            writeServiceRefs();
+            new OsgiServiceProviderWriter(writer).write(context.getBeans());
+            
+            writer.writeEndElement();
+            writer.writeCharacters("\n");
+            writer.writeEndDocument();
+            writer.writeCharacters("\n");
+            writer.close();
+        } catch (XMLStreamException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    private void writeBlueprint() throws XMLStreamException {
+        writer.writeStartElement("blueprint");
+        writer.writeDefaultNamespace(NS_BLUEPRINT);
+        writer.writeNamespace("ext", NS_EXT);
+        writer.writeNamespace("jpa", NS_JPA);
+        writer.writeNamespace("tx", NS_TX);
+        writer.writeCharacters("\n");
+    }
+    
+    public void writeBeanStart(Bean bean) throws XMLStreamException {
+        writer.writeStartElement("bean");
+        writer.writeAttribute("id", bean.id);
+        writer.writeAttribute("class", bean.clazz.getName());
+        writer.writeAttribute("ext", NS_EXT, "field-injection", "true");
+        if (bean.initMethod != null) {
+            writer.writeAttribute("init-method", bean.initMethod);
+        }
+        if (bean.destroyMethod != null) {
+            writer.writeAttribute("destroy-method", bean.destroyMethod);
+        }
+        writer.writeCharacters("\n");
+        writeTransactional(bean.transactionDef);
+
+        if (bean.persistenceUnitField != null) {
+            writePersistenceUnit(bean.persistenceUnitField);
+        }
+    }
+    
+    private void writeTransactional(TransactionalDef transactionDef)
+            throws XMLStreamException {
+        if (transactionDef != null) {
+            writer.writeCharacters("    ");
+            writer.writeEmptyElement("tx", "transaction", NS_TX);
+            writer.writeAttribute("method", transactionDef.getMethod());
+            writer.writeAttribute("value", transactionDef.getType());
+            writer.writeCharacters("\n");
+        }
+    }
+
+    private void writePersistenceUnit(Field field) throws XMLStreamException {
+        PersistenceUnit persistenceUnit = field.getAnnotation(PersistenceUnit.class);
+        if (persistenceUnit !=null) {
+            writer.writeCharacters("    ");
+            writer.writeEmptyElement("jpa", "context", NS_JPA);
+            writer.writeAttribute("unitname", persistenceUnit.unitName());
+            writer.writeAttribute("property", field.getName());
+            writer.writeCharacters("\n");
+        }
+    }
+    
+    private void writeServiceRefs() throws XMLStreamException {
+        for (OsgiServiceBean serviceBean : context.getServiceRefs()) {
+            writeServiceRef(serviceBean);
+        }
+    }
+
+    private void writeServiceRef(OsgiServiceBean serviceBean) throws XMLStreamException {
+        writer.writeEmptyElement("reference");
+        writer.writeAttribute("id", serviceBean.id);
+        writer.writeAttribute("interface", serviceBean.clazz.getName());
+        if (serviceBean.filter != null && !"".equals(serviceBean.filter)) {
+            writer.writeAttribute("filter", serviceBean.filter);
+        }
+        writer.writeCharacters("\n");
+    }
+
+    @Override
+    public void writeProperty(Property property) {
+        try {
+            writer.writeCharacters("    ");
+            writer.writeEmptyElement("property");
+            writer.writeAttribute("name", property.name);
+            if (property.ref != null) {
+                writer.writeAttribute("ref", property.ref);
+            } else if (property.value != null) {
+                writer.writeAttribute("value", property.value);
+            }
+            writer.writeCharacters("\n");
+        } catch (XMLStreamException e) {
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceProviderWriter.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceProviderWriter.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceProviderWriter.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/OsgiServiceProviderWriter.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin;
+
+import java.util.Collection;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.aries.blueprint.plugin.model.Bean;
+import org.ops4j.pax.cdi.api.OsgiServiceProvider;
+import org.ops4j.pax.cdi.api.Properties;
+import org.ops4j.pax.cdi.api.Property;
+
+public class OsgiServiceProviderWriter {
+    private XMLStreamWriter writer;
+
+    public OsgiServiceProviderWriter(XMLStreamWriter writer) {
+        this.writer = writer;
+    }
+
+    public void write(Collection<Bean> beans) throws XMLStreamException {
+        for (Bean bean : beans) {
+            write(bean);
+        }
+    }
+    
+    public void write(Bean bean) throws XMLStreamException {
+        OsgiServiceProvider serviceProvider = bean.clazz.getAnnotation(OsgiServiceProvider.class);
+        if (serviceProvider == null) {
+            return;
+        }
+        if (serviceProvider.classes().length == 0) {
+            throw new IllegalArgumentException("Need to provide the interface class in the @OsgiServiceProvider(classes={...}) annotation on " + bean.clazz);
+        }
+        Properties properties = bean.clazz.getAnnotation(Properties.class);
+        if (properties == null) {
+            writer.writeEmptyElement("service");
+        } else {
+            writer.writeStartElement("service");
+        }
+        writer.writeAttribute("ref", bean.id);
+        Class<?> serviceIf = serviceProvider.classes()[0];
+        writer.writeAttribute("interface", serviceIf.getName());
+        writer.writeCharacters("\n");
+        if (properties != null) {
+            writeProperties(properties);
+            writer.writeEndElement();
+            writer.writeCharacters("\n");
+        }
+    }
+
+    private void writeProperties(Properties properties) throws XMLStreamException {
+        writer.writeCharacters("    ");
+        writer.writeStartElement("service-properties");
+        writer.writeCharacters("\n");
+        for (Property property : properties.value()) {
+            writer.writeCharacters("        ");
+            writer.writeEmptyElement("entry");
+            writer.writeAttribute("key", property.name());
+            writer.writeAttribute("value", property.value());
+            writer.writeCharacters("\n");
+        }
+        writer.writeCharacters("    ");
+        writer.writeEndElement();
+        writer.writeCharacters("\n");
+    }
+
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Named;
+import javax.persistence.PersistenceUnit;
+
+import org.springframework.stereotype.Component;
+
+public class Bean implements Comparable<Bean>{
+    public String id;
+    public Class<?> clazz;
+    public String initMethod;
+    public String destroyMethod;
+    public SortedSet<Property> properties;
+    public Field persistenceUnitField;
+    public TransactionalDef transactionDef; 
+    
+    public Bean(Class<?> clazz) {
+        this.clazz = clazz;
+        this.id = getBeanName(clazz);
+        for (Method method : clazz.getDeclaredMethods()) {
+            PostConstruct postConstruct = method.getAnnotation(PostConstruct.class);
+            if (postConstruct != null) {
+                this.initMethod = method.getName();
+            }
+            PreDestroy preDestroy = method.getAnnotation(PreDestroy.class);
+            if (preDestroy != null) {
+                this.destroyMethod = method.getName();
+            }
+        }
+        this.persistenceUnitField = getPersistenceUnit();
+        this.transactionDef = new JavaxTransactionFactory().create(clazz);
+        if (this.transactionDef == null) {
+            this.transactionDef = new SpringTransactionFactory().create(clazz);
+        }
+        properties = new TreeSet<Property>();
+    }
+
+    private Field getPersistenceUnit() {
+        Field[] fields = clazz.getDeclaredFields();
+        for (Field field : fields) {
+            PersistenceUnit persistenceUnit = field.getAnnotation(PersistenceUnit.class);
+            if (persistenceUnit !=null) {
+                 return field;
+            }
+        }
+        return null;
+    }
+    
+    public void resolve(Matcher matcher) {
+        Class<?> curClass = this.clazz;
+        while (curClass != Object.class) {
+            resolveProperties(matcher, curClass);
+            curClass = curClass.getSuperclass();
+        }
+    }
+    
+    private void resolveProperties(Matcher matcher, Class<?> curClass) {
+        for (Field field : curClass.getDeclaredFields()) {
+            Property prop = Property.create(matcher, field);
+            if (prop != null) {
+                properties.add(prop);
+            }
+        }
+    }
+
+    public static String getBeanName(Class<?> clazz) {
+        Component component = clazz.getAnnotation(Component.class);
+        Named named = clazz.getAnnotation(Named.class);
+        if (component != null && !"".equals(component.value())) {
+            return component.value();
+        } else if (named != null && !"".equals(named.value())) {
+            return named.value();    
+        } else {
+            String name = clazz.getSimpleName();
+            return getBeanNameFromSimpleName(name);
+        }
+    }
+
+    private static String getBeanNameFromSimpleName(String name) {
+        return name.substring(0, 1).toLowerCase() + name.substring(1, name.length());
+    }
+
+    public boolean matches(Class<?> destType, String destId) {
+        boolean assignable = destType.isAssignableFrom(this.clazz);
+        return assignable && ((destId == null) || id.equals(destId));
+    }
+
+    @Override
+    public int compareTo(Bean other) {
+        return this.clazz.getName().compareTo(other.clazz.getName());
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((clazz == null) ? 0 : clazz.getName().hashCode());
+        result = prime * result + ((id == null) ? 0 : id.hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return clazz.getName();
+    }
+
+    public void writeProperties(PropertyWriter writer) {
+        for (Property property : properties) {
+            writer.writeProperty(property);
+        }
+    }
+    
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,95 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.inject.Named;
+
+import org.ops4j.pax.cdi.api.OsgiService;
+
+public class Context implements Matcher {
+
+    SortedSet<Bean> beans;
+    SortedSet<OsgiServiceBean> serviceRefs;
+    
+    public Context(Class<?>... beanClasses) {
+        this(Arrays.asList(beanClasses));
+    }
+
+    public Context(Collection<Class<?>> beanClasses) {
+        this.beans = new TreeSet<Bean>();
+        this.serviceRefs = new TreeSet<OsgiServiceBean>();
+        addBeans(beanClasses);
+    }
+
+    private void addBeans(Collection<Class<?>> beanClasses) {
+        for (Class<?> clazz : beanClasses) {
+            Bean bean = new Bean(clazz);
+            beans.add(bean);
+            addServiceRefs(clazz);
+        }
+    }
+
+    private void addServiceRefs(Class<?> clazz) {
+        for (Field field : clazz.getDeclaredFields()) {
+            OsgiService osgiService = field.getAnnotation(OsgiService.class);
+            if (osgiService != null) {
+                serviceRefs.add(new OsgiServiceBean(field.getType(), osgiService));
+            }
+        }
+    }
+    
+    public void resolve() {
+        for (Bean bean : beans) {
+            bean.resolve(this);
+        }
+    }
+    
+    public Bean getMatching(Field field) {
+        Named named = field.getAnnotation(Named.class);
+        String destId = (named == null) ? null : named.value();
+        // TODO Replace loop by lookup
+        for (Bean bean : beans) {
+            if (bean.matches(field.getType(), destId)) {
+                return bean;
+            }
+        }
+        for (Bean bean : serviceRefs) {
+            if (bean.matches(field.getType(), destId)) {
+                return bean;
+            }
+        }
+        return null;
+    }
+
+    public SortedSet<Bean> getBeans() {
+        return beans;
+    }
+    
+    public SortedSet<OsgiServiceBean> getServiceRefs() {
+        return serviceRefs;
+    }
+
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.util.HashMap;
+
+import javax.transaction.Transactional;
+import javax.transaction.Transactional.TxType;
+
+public class JavaxTransactionFactory {
+    private static HashMap<TxType, String> txTypeNames;
+
+    static {
+        txTypeNames = new HashMap<TxType, String>();
+        txTypeNames.put(TxType.REQUIRED, TransactionalDef.TYPE_REQUIRED);
+        txTypeNames.put(TxType.REQUIRES_NEW, TransactionalDef.TYPE_REQUIRES_NEW);
+    }
+    
+    TransactionalDef create(Class<?> clazz) {
+        Transactional transactional = clazz.getAnnotation(Transactional.class);
+        return transactional != null ? 
+                new TransactionalDef("*", txTypeNames.get(transactional.value())) : null;
+    }
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Matcher.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Matcher.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Matcher.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Matcher.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.lang.reflect.Field;
+
+
+public interface Matcher {
+    Bean getMatching(Field field);
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceBean.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceBean.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceBean.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceBean.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import org.ops4j.pax.cdi.api.OsgiService;
+
+/**
+ * Synthetic bean that refers to an OSGi service
+ */
+public class OsgiServiceBean extends Bean {
+
+    public String filter;
+
+    public OsgiServiceBean(Class<?> clazz, OsgiService osgiService) {
+        super(clazz);
+        filter = osgiService.filter();
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.lang.reflect.Field;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+
+public class Property implements Comparable<Property> {
+    public String name;
+    public String ref;
+    public String value;
+
+    public Property(String name, String ref, String value) {
+        this.name = name;
+        this.ref = ref;
+        this.value = value;
+    }
+
+    public static Property create(Matcher matcher, Field field) {
+        Value value = field.getAnnotation(Value.class);
+        if (needsInject(field)) {
+            Bean matching = matcher.getMatching(field);
+            String ref = (matching == null) ? getRefName(field) : matching.id;
+            return new Property(field.getName(), ref, null);
+        } else if (value != null){
+            return new Property(field.getName(), null, cleanValue(value.value()));
+        } else {
+            // Field is not a property
+            return null;
+        }
+    }
+
+    /**
+     * Assume it is defined in another manually created blueprint context with default name
+     * @param field
+     * @return
+     */
+    private static String getRefName(Field field) {
+        Named named = field.getAnnotation(Named.class);
+        return (named != null) ? named.value() : Bean.getBeanName(field.getType());
+    }
+
+    private static boolean needsInject(Field field) {
+        return field.getAnnotation(Autowired.class) != null || field.getAnnotation(Inject.class) != null;
+    }
+
+    /**
+     * Remove default value definition
+     * 
+     * @param value
+     * @return
+     */
+    private static String cleanValue(String value) {
+        return value.replaceAll("\\:.*\\}", "}");
+    }
+
+    @Override
+    public int compareTo(Property other) {
+        return name.compareTo(other.name);
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+
+public interface PropertyWriter {
+    void writeProperty(Property property);
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.util.HashMap;
+
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+public class SpringTransactionFactory {
+    private static HashMap<Propagation, String> txTypeNames;
+
+    static {
+        txTypeNames = new HashMap<Propagation, String>();
+        txTypeNames.put(Propagation.REQUIRED, TransactionalDef.TYPE_REQUIRED);
+        txTypeNames.put(Propagation.REQUIRES_NEW, TransactionalDef.TYPE_REQUIRES_NEW);
+    }
+
+    TransactionalDef create(Class<?> clazz) {
+        Transactional transactional = clazz.getAnnotation(Transactional.class);
+        return transactional != null ? 
+                new TransactionalDef("*", txTypeNames.get(transactional.propagation())) : null;
+    }
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/TransactionalDef.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/TransactionalDef.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/TransactionalDef.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/TransactionalDef.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+
+public class TransactionalDef {
+    public static final String TYPE_REQUIRED = "Required";
+    public static final String TYPE_REQUIRES_NEW = "RequiresNew";
+    private String method;
+    private String type;
+    
+    public TransactionalDef(String method, String type) {
+        this.method = method;
+        this.type = type;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+    
+    public String getType() {
+        return type;
+    }
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/GeneratorTest.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin;
+
+import static java.util.Arrays.asList;
+import static org.apache.aries.blueprint.plugin.FilteredClassFinder.findClasses;
+
+import java.util.Set;
+
+import org.apache.aries.blueprint.plugin.Generator;
+import org.apache.aries.blueprint.plugin.model.Context;
+import org.apache.aries.blueprint.plugin.test.MyBean1;
+import org.apache.xbean.finder.ClassFinder;
+import org.junit.Test;
+
+
+public class GeneratorTest {
+    @Test
+    public void testGenerate() throws Exception {
+        ClassFinder classFinder = new ClassFinder(this.getClass().getClassLoader());
+        String packageName = MyBean1.class.getPackage().getName();
+        Set<Class<?>> beanClasses = findClasses(classFinder, asList(packageName));
+        Context context = new Context(beanClasses);
+        context.resolve();
+        new Generator(context, System.out).generate();
+    }
+    
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import javax.inject.Named;
+
+import org.apache.aries.blueprint.plugin.test.MyBean1;
+import org.apache.aries.blueprint.plugin.test.MyBean3;
+import org.apache.aries.blueprint.plugin.test.ServiceAImpl1;
+import org.junit.Test;
+
+
+public class BeanTest {
+    
+    @Test
+    public void testParseMyBean1() {
+        Bean bean = new Bean(MyBean1.class);
+        bean.resolve(new Context());
+        assertEquals(MyBean1.class, bean.clazz);
+        assertEquals("myBean1", bean.id); // Name derived from class name
+        assertEquals("init", bean.initMethod);
+        assertEquals("destroy", bean.destroyMethod);
+        assertEquals("em", bean.persistenceUnitField.getName());
+        assertEquals("*", bean.transactionDef.getMethod());
+        assertEquals("Required", bean.transactionDef.getType());
+        assertEquals(1, bean.properties.size());
+        Property prop = bean.properties.iterator().next();
+        assertEquals("bean2", prop.name);
+        assertEquals("serviceA", prop.ref);
+    }
+    
+    @Test
+    public void testParseMyBean3() {
+        Bean bean = new Bean(MyBean3.class);
+        bean.resolve(new Context());
+        assertEquals(MyBean3.class, bean.clazz);
+        assertEquals("myBean3", bean.id); // Name derived from class name
+        assertNull("There should be no initMethod", bean.initMethod);
+        assertNull("There should be no destroyMethod", bean.destroyMethod);
+        assertNull("There should be no persistenceUnit", bean.persistenceUnitField);
+        assertEquals("*", bean.transactionDef.getMethod());
+        assertEquals("RequiresNew", bean.transactionDef.getType());
+        assertEquals(3, bean.properties.size());
+    }
+    
+    @Test
+    public void testParseNamedBean() {
+        Bean bean = new Bean(ServiceAImpl1.class);
+        bean.resolve(new Context());
+        String definedName = ServiceAImpl1.class.getAnnotation(Named.class).value();
+        assertEquals("my1", definedName);
+        assertEquals("Name should be defined using @Named", definedName, bean.id);
+        assertNull("There should be no initMethod", bean.initMethod);
+        assertNull("There should be no destroyMethod", bean.destroyMethod);
+        assertNull("There should be no persistenceUnit", bean.persistenceUnitField);
+        assertNull("There should be no transaction definition", bean.transactionDef);
+        assertEquals("There should be no properties", 0, bean.properties.size());
+    }
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/ContextTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/ContextTest.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/ContextTest.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/ContextTest.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.lang.reflect.Field;
+
+import org.apache.aries.blueprint.plugin.model.Bean;
+import org.apache.aries.blueprint.plugin.model.Context;
+import org.apache.aries.blueprint.plugin.model.OsgiServiceBean;
+import org.apache.aries.blueprint.plugin.test.MyBean3;
+import org.apache.aries.blueprint.plugin.test.ServiceB;
+import org.apache.aries.blueprint.plugin.test.ServiceReferences;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ContextTest {
+
+    @Test
+    public void testLists()  {
+        Context context = new Context(MyBean3.class);
+        Assert.assertEquals(1, context.getBeans().size());
+        Assert.assertEquals(0, context.getServiceRefs().size());
+    }
+    
+    @Test
+    public void testLists2()  {
+        Context context = new Context(ServiceReferences.class);
+        Assert.assertEquals(1, context.getBeans().size());
+        Assert.assertEquals(1, context.getServiceRefs().size());
+    }
+    
+    @Test
+    public void testMatching() throws NoSuchFieldException, SecurityException  {
+        Context context = new Context(ServiceReferences.class);
+        Field field = ServiceReferences.class.getDeclaredFields()[0];
+        Bean matching = context.getMatching(field);
+        Assert.assertEquals(OsgiServiceBean.class, matching.getClass());
+        Assert.assertEquals(ServiceB.class, matching.clazz);
+        Assert.assertEquals("serviceB", matching.id);
+    }
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/PropertyTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/PropertyTest.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/PropertyTest.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/PropertyTest.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import java.lang.reflect.Field;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.aries.blueprint.plugin.model.Bean;
+import org.apache.aries.blueprint.plugin.model.Matcher;
+import org.apache.aries.blueprint.plugin.model.Property;
+import org.apache.aries.blueprint.plugin.test.ServiceAImpl1;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class PropertyTest {
+    @Test
+    public void testRefInject() throws XMLStreamException {
+        Field field = TestBeanForRef.class.getDeclaredFields()[0];
+        Matcher matcher = new Matcher() {
+            public Bean getMatching(Field field) {
+                return new Bean(ServiceAImpl1.class);
+            }
+        };
+        Property property = Property.create(matcher, field);
+        Assert.assertEquals("serviceA", property.name);
+        Assert.assertNull("Value should be null", property.value);
+        Assert.assertEquals("my1", property.ref);
+    }
+    
+    @Test
+    public void testRefAutowired() throws XMLStreamException {
+        Field field = TestBeanForRef.class.getDeclaredFields()[1];
+        Matcher matcher = new Matcher() {
+            public Bean getMatching(Field field) {
+                return null;
+            }
+        };
+        Property property = Property.create(matcher, field);
+        Assert.assertEquals("serviceB", property.name);
+        Assert.assertNull("Value should be null", property.value);
+        Assert.assertEquals("Should be default name as no match is found", "serviceB", property.ref);
+    }
+
+    @Test
+    public void testValue() throws XMLStreamException {
+        Field field = TestBeanForRef.class.getDeclaredFields()[2];
+        Property property = Property.create(null, field);
+        Assert.assertEquals("name", property.name);
+        Assert.assertEquals("${name}", property.value);
+        Assert.assertNull("Ref should be null", property.ref);
+    }
+    
+    @Test
+    public void testNoProperty() throws XMLStreamException {
+        Field field = TestBeanForRef.class.getDeclaredFields()[3];
+        Property property = Property.create(null, field);
+        Assert.assertNull("Should not be a property", property);
+    }
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/TestBeanForRef.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/TestBeanForRef.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/TestBeanForRef.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/TestBeanForRef.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.model;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceUnit;
+
+import org.apache.aries.blueprint.plugin.test.ServiceA;
+import org.apache.aries.blueprint.plugin.test.ServiceB;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+
+@Singleton
+public class TestBeanForRef {
+    @Inject ServiceA serviceA;
+    @Autowired ServiceB serviceB;
+    @Value("${name:default}") String name;
+    @PersistenceUnit(unitName="myunit") EntityManager em;
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean1.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.test;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Singleton;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceUnit;
+import javax.transaction.Transactional;
+import javax.transaction.Transactional.TxType;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+@Singleton
+@Transactional(value=TxType.REQUIRED)
+public class MyBean1 {
+
+    @Autowired
+    ServiceA bean2;
+    
+    @PersistenceUnit(unitName="person")
+    EntityManager em;
+    
+    @PostConstruct
+    public void init() {
+        
+    }
+    
+    @PreDestroy
+    public void destroy() {
+        
+    }
+
+    public void saveData() {
+        
+    }
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/MyBean3.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.test;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+@Singleton
+@Transactional(propagation=Propagation.REQUIRES_NEW)
+public class MyBean3 {
+
+    @Inject
+    @Named("my1")
+    ServiceA serviceA1;
+
+    @Inject
+    @Named("my2")
+    ServiceA serviceA2;
+
+    @Inject
+    ServiceB serviceB;
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceA.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceA.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceA.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceA.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.test;
+
+public interface ServiceA {
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl1.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl1.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl1.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl1.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.test;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+@Singleton
+@Named("my1")
+public class ServiceAImpl1 implements ServiceA {
+    
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl2.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl2.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl2.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceAImpl2.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.test;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.ops4j.pax.cdi.api.OsgiServiceProvider;
+import org.springframework.beans.factory.annotation.Value;
+
+@Singleton
+@Named("my2")
+@OsgiServiceProvider(classes={ServiceA.class})
+public class ServiceAImpl2 implements ServiceA {
+    @Value("${url:http://default}")
+    String url;
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceB.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceB.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceB.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceB.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.test;
+
+public interface ServiceB {
+
+}

Added: aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceReferences.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceReferences.java?rev=1636323&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceReferences.java (added)
+++ aries/trunk/blueprint/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/test/ServiceReferences.java Mon Nov  3 11:35:40 2014
@@ -0,0 +1,30 @@
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.blueprint.plugin.test;
+
+import javax.inject.Inject;
+
+import org.ops4j.pax.cdi.api.OsgiService;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServiceReferences {
+    @Inject @OsgiService ServiceB serviceB;
+}

Modified: aries/trunk/blueprint/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/pom.xml?rev=1636323&r1=1636322&r2=1636323&view=diff
==============================================================================
--- aries/trunk/blueprint/pom.xml (original)
+++ aries/trunk/blueprint/pom.xml Mon Nov  3 11:35:40 2014
@@ -45,6 +45,7 @@
         <module>blueprint-bundle</module>
         <module>blueprint-compatibility</module>
         <module>blueprint-core-compatibility</module>
+        <module>blueprint-maven-plugin</module>
         <module>blueprint-noosgi</module>
         <module>blueprint-web</module>
         <module>blueprint-web-osgi</module>



Mime
View raw message