[ARIES-1570] Create SPI and move spring annotations to separate package
git-svn-id: https://svn.apache.org/repos/asf/aries/trunk@1750823 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/blueprint/blueprint-maven-plugin/pom.xml b/blueprint/blueprint-maven-plugin/pom.xml
index 863a16e..48fa1ae 100644
--- a/blueprint/blueprint-maven-plugin/pom.xml
+++ b/blueprint/blueprint-maven-plugin/pom.xml
@@ -77,7 +77,6 @@
</execution>
</executions>
</plugin>
-
</plugins>
<pluginManagement>
<plugins>
@@ -106,7 +105,7 @@
</goals>
</pluginExecutionFilter>
<action>
- <ignore />
+ <ignore/>
</action>
</pluginExecution>
</pluginExecutions>
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Extensions.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Extensions.java
new file mode 100644
index 0000000..84b1b1d
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Extensions.java
@@ -0,0 +1,72 @@
+/**
+ * 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 org.apache.aries.blueprint.plugin.model.AbstractTransactionalFactory;
+import org.apache.aries.blueprint.plugin.model.ExtensionTransactionFactory;
+import org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver;
+import org.apache.aries.blueprint.plugin.spi.BeanFinder;
+import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
+import org.apache.aries.blueprint.plugin.spi.TransactionalFactory;
+import org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ServiceLoader;
+
+public class Extensions {
+ public static final List<Class<? extends Annotation>> beanMarkingAnnotationClasses = new ArrayList<>();
+ public static final List<Class<? extends Annotation>> singletons = new ArrayList<>();
+ public static final List<AbstractTransactionalFactory> transactionalFactories = new ArrayList<>();
+ public static final List<BeanAttributesResolver> beanAttributesResolvers = new ArrayList<>();
+ public static final List<InjectLikeHandler<? extends Annotation>> beanInjectLikeHandlers = new ArrayList<>();
+ public static final List<NamedLikeHandler> namedLikeHandlers = new ArrayList<>();
+ public static final List<ValueInjectionHandler<? extends Annotation>> valueInjectionHandlers = new ArrayList<>();
+
+ static {
+ for (BeanFinder beanFinder : ServiceLoader.load(BeanFinder.class)) {
+ beanMarkingAnnotationClasses.add(beanFinder.beanAnnotation());
+ if (beanFinder.isSingleton()) {
+ singletons.add(beanFinder.beanAnnotation());
+ }
+ }
+
+ for (TransactionalFactory transactionalFactory : ServiceLoader.load(TransactionalFactory.class)) {
+ transactionalFactories.add(new ExtensionTransactionFactory(transactionalFactory));
+ }
+
+ for (BeanAttributesResolver beanAttributesResolverExtenstion : ServiceLoader.load(BeanAttributesResolver.class)) {
+ beanAttributesResolvers.add(beanAttributesResolverExtenstion);
+ }
+
+ for (InjectLikeHandler<? extends Annotation> injectLikeHandler : ServiceLoader.load(InjectLikeHandler.class)) {
+ beanInjectLikeHandlers.add(injectLikeHandler);
+ }
+
+ for (NamedLikeHandler namedLikeHandler : ServiceLoader.load(NamedLikeHandler.class)) {
+ namedLikeHandlers.add(namedLikeHandler);
+ }
+
+ for (ValueInjectionHandler<? extends Annotation> valueInjectionHandler : ServiceLoader.load(ValueInjectionHandler.class)) {
+ valueInjectionHandlers.add(valueInjectionHandler);
+ }
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java
index a9f630d..7d54e50 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/FilteredClassFinder.java
@@ -6,9 +6,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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
@@ -19,20 +19,17 @@
package org.apache.aries.blueprint.plugin;
import org.apache.xbean.finder.ClassFinder;
-import org.springframework.stereotype.Component;
-import javax.inject.Named;
-import javax.inject.Singleton;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
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, Named.class});
+ return findClasses(finder, packageNames, Extensions.beanMarkingAnnotationClasses.toArray(new Class[Extensions.beanMarkingAnnotationClasses.size()]));
}
public static Set<Class<?>> findClasses(ClassFinder finder, Collection<String> packageNames, Class<? extends Annotation>[] annotations) {
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java
index 478723c..b26920c 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/GenerateMojo.java
@@ -43,7 +43,7 @@
import java.util.Set;
/**
- * Generates blueprint from CDI and spring annotations
+ * Generates blueprint from CDI annotations
*/
@Mojo(name="blueprint-generate", requiresDependencyResolution=ResolutionScope.COMPILE,
defaultPhase=LifecyclePhase.PROCESS_CLASSES, inheritByDefault=false)
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
index 8d6cc4c..77e51f7 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/Generator.java
@@ -38,6 +38,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
public class Generator implements PropertyWriter, ArgumentWriter {
@@ -55,7 +56,7 @@
public Generator(Context context, OutputStream os, Set<String> namespaces, Activation defaultActivation) throws XMLStreamException {
this.context = context;
- this.namespaces = namespaces != null ? namespaces : new HashSet<>(Arrays.asList(NS_TX2, NS_JPA2));
+ this.namespaces = namespaces != null ? namespaces : new HashSet<>(Arrays.asList(NS_TX2, NS_JPA2));
this.defaultActivation = defaultActivation;
XMLOutputFactory factory = XMLOutputFactory.newInstance();
writer = factory.createXMLStreamWriter(os);
@@ -153,11 +154,10 @@
if (bean.isPrototype) {
writer.writeAttribute("scope", "prototype");
}
- if (bean.activation != null) {
- writer.writeAttribute("activation", bean.activation.toString());
- }
- if (bean.dependsOn != null) {
- writer.writeAttribute("depends-on", bean.dependsOn);
+
+ Map<String, String> attributes = bean.attributes;
+ for (Map.Entry<String, String> entry : attributes.entrySet()) {
+ writer.writeAttribute(entry.getKey(), entry.getValue());
}
if (bean instanceof ProducedBean) {
writeFactory((ProducedBean) bean);
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/InjectHandler.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/InjectHandler.java
new file mode 100644
index 0000000..2894dc9
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/InjectHandler.java
@@ -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.javax;
+
+import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
+
+import javax.inject.Inject;
+
+public class InjectHandler implements InjectLikeHandler<Inject> {
+ @Override
+ public Class<Inject> getAnnotation() {
+ return Inject.class;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/JavaxTransactionFactory.java
similarity index 78%
rename from blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java
rename to blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/JavaxTransactionFactory.java
index 24c815a..4835ce4 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/JavaxTransactionFactory.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/JavaxTransactionFactory.java
@@ -6,9 +6,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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
@@ -16,18 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.aries.blueprint.plugin.model;
+package org.apache.aries.blueprint.plugin.javax;
-import java.util.HashMap;
+import com.google.common.base.CaseFormat;
+import org.apache.aries.blueprint.plugin.model.TransactionalDef;
+import org.apache.aries.blueprint.plugin.spi.TransactionalFactory;
import javax.transaction.Transactional;
import javax.transaction.Transactional.TxType;
+import java.util.HashMap;
-import com.google.common.base.CaseFormat;
-
-public class JavaxTransactionFactory extends AbstractTransactionalFactory<Transactional> {
+public class JavaxTransactionFactory implements TransactionalFactory<Transactional> {
private static HashMap<TxType, String> txTypeNames;
-
+
static {
txTypeNames = new HashMap<TxType, String>();
txTypeNames.put(TxType.REQUIRED, TransactionalDef.TYPE_REQUIRED);
@@ -35,14 +36,12 @@
}
@Override
- public String getTransactionTypeName(Transactional transactional)
- {
+ public String getTransactionTypeName(Transactional transactional) {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, transactional.value().name());
}
@Override
- public Class<Transactional> getTransactionalClass()
- {
+ public Class<Transactional> getTransactionalClass() {
return Transactional.class;
}
}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/NamedBeanFinder.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/NamedBeanFinder.java
new file mode 100644
index 0000000..19110bd
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/NamedBeanFinder.java
@@ -0,0 +1,33 @@
+/**
+ * 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.javax;
+
+import javax.inject.Named;
+
+public class NamedBeanFinder implements org.apache.aries.blueprint.plugin.spi.BeanFinder<Named> {
+ @Override
+ public Class<Named> beanAnnotation() {
+ return Named.class;
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return false;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/NamedHandler.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/NamedHandler.java
new file mode 100644
index 0000000..981bffa
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/NamedHandler.java
@@ -0,0 +1,49 @@
+/**
+ * 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.javax;
+
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
+
+import javax.inject.Named;
+import java.lang.reflect.AnnotatedElement;
+
+public class NamedHandler implements NamedLikeHandler {
+ @Override
+ public Class getAnnotation() {
+ return Named.class;
+ }
+
+ @Override
+ public String getName(Class clazz, AnnotatedElement annotatedElement) {
+ Named annotation = annotatedElement.getAnnotation(Named.class);
+ if (annotation.value() == null || "".equals(annotation.value())) {
+ return null;
+ }
+ return annotation.value();
+ }
+
+ @Override
+ public String getName(Object annotation) {
+ Named named = Named.class.cast(annotation);
+ if (named.value() == null || "".equals(named.value())) {
+ return null;
+ }
+ return named.value();
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/SingletonBeanFinder.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/SingletonBeanFinder.java
new file mode 100644
index 0000000..4cc9105
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/javax/SingletonBeanFinder.java
@@ -0,0 +1,33 @@
+/**
+ * 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.javax;
+
+import javax.inject.Singleton;
+
+public class SingletonBeanFinder implements org.apache.aries.blueprint.plugin.spi.BeanFinder<Singleton> {
+ @Override
+ public Class<Singleton> beanAnnotation() {
+ return Singleton.class;
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return true;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java
new file mode 100644
index 0000000..d035e5f
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/AnnotationHelper.java
@@ -0,0 +1,88 @@
+/**
+ * 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.apache.aries.blueprint.plugin.Extensions;
+import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
+import org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AnnotationHelper {
+ public static Class<? extends Annotation>[] injectDependencyAnnotations = findInjectDependencyAnnotations();
+
+ private static Class<? extends Annotation>[] findInjectDependencyAnnotations() {
+ List<Class<? extends Annotation>> classes = new ArrayList<>();
+ for (InjectLikeHandler<? extends Annotation> injectLikeHandler : Extensions.beanInjectLikeHandlers) {
+ classes.add(injectLikeHandler.getAnnotation());
+ }
+ for (ValueInjectionHandler<? extends Annotation> valueInjectionHandler : Extensions.valueInjectionHandlers) {
+ classes.add(valueInjectionHandler.getAnnotation());
+ }
+ return classes.toArray(new Class[classes.size()]);
+ }
+
+ public static String findValue(Annotation[] annotations) {
+ for (ValueInjectionHandler valueInjectionHandler : Extensions.valueInjectionHandlers) {
+ Object annotation = findAnnotation(annotations, valueInjectionHandler.getAnnotation());
+ if (annotation != null) {
+ String value = valueInjectionHandler.getValue(annotation);
+ if (value != null) {
+ return value;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static String findName(Annotation[] annotations) {
+ for (NamedLikeHandler namedLikeHandler : Extensions.namedLikeHandlers) {
+ Object annotation = findAnnotation(annotations, namedLikeHandler.getAnnotation());
+ if (annotation != null) {
+ String value = namedLikeHandler.getName(annotation);
+ if (value != null) {
+ return value;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static <T> T findAnnotation(Annotation[] annotations, Class<T> annotation) {
+ for (Annotation a : annotations) {
+ if (a.annotationType() == annotation) {
+ return annotation.cast(a);
+ }
+ }
+ return null;
+ }
+
+ public static boolean findSingletons(Annotation[] annotations) {
+ for (Class<? extends Annotation> singletonAnnotation : Extensions.singletons) {
+ Object annotation = findAnnotation(annotations, singletonAnnotation);
+ if (annotation != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
index 561ea4f..920bb9a 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
@@ -18,21 +18,14 @@
*/
package org.apache.aries.blueprint.plugin.model;
-import org.apache.aries.blueprint.plugin.Activation;
+import org.apache.aries.blueprint.plugin.Extensions;
import org.apache.aries.blueprint.plugin.model.service.ServiceProvider;
-import org.apache.commons.lang.StringUtils;
+import org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver;
+import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
import org.ops4j.pax.cdi.api.OsgiService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.DependsOn;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;
import java.lang.annotation.Annotation;
@@ -41,12 +34,18 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
+import static org.apache.aries.blueprint.plugin.model.AnnotationHelper.findAnnotation;
+import static org.apache.aries.blueprint.plugin.model.AnnotationHelper.findName;
+import static org.apache.aries.blueprint.plugin.model.AnnotationHelper.findValue;
+
public class Bean extends BeanRef {
public final String initMethod;
public String destroyMethod;
@@ -57,16 +56,12 @@
public Set<TransactionalDef> transactionDefs = new HashSet<>();
public boolean isPrototype;
public List<ServiceProvider> serviceProviders = new ArrayList<>();
- public Activation activation;
- public String dependsOn;
+ public final Map<String, String> attributes = new HashMap<>();
public Bean(Class<?> clazz) {
super(clazz, BeanRef.getBeanName(clazz));
Introspector introspector = new Introspector(clazz);
- activation = getActivation(clazz);
- dependsOn = getDependsOn(clazz);
-
initMethod = findMethodAnnotatedWith(introspector, PostConstruct.class);
destroyMethod = findMethodAnnotatedWith(introspector, PreDestroy.class);
@@ -78,23 +73,16 @@
setQualifiersFromAnnotations(clazz.getAnnotations());
interpretServiceProvider();
+
+ resolveBeanAttributes();
}
- protected String getDependsOn(AnnotatedElement annotatedElement) {
- DependsOn annotation = annotatedElement.getAnnotation(DependsOn.class);
- if (annotation == null || annotation.value().length == 0) {
- return null;
+ private void resolveBeanAttributes() {
+ for (BeanAttributesResolver beanAttributesResolver : Extensions.beanAttributesResolvers) {
+ if (clazz.getAnnotation(beanAttributesResolver.getAnnotation()) != null) {
+ attributes.putAll(beanAttributesResolver.resolveAttributes(clazz, clazz));
+ }
}
- String[] value = annotation.value();
- return StringUtils.join(value, " ");
- }
-
- protected Activation getActivation(AnnotatedElement annotatedElement) {
- Lazy lazy = annotatedElement.getAnnotation(Lazy.class);
- if (lazy == null) {
- return null;
- }
- return lazy.value() ? Activation.LAZY : Activation.EAGER;
}
private void interpretServiceProvider() {
@@ -109,8 +97,9 @@
}
private void interpretTransactionalMethods(Class<?> clazz) {
- transactionDefs.addAll(new JavaxTransactionFactory().create(clazz));
- transactionDefs.addAll(new SpringTransactionFactory().create(clazz));
+ for (AbstractTransactionalFactory transactionalFactory : Extensions.transactionalFactories) {
+ transactionDefs.addAll(transactionalFactory.create(clazz));
+ }
}
private String findMethodAnnotatedWith(Introspector introspector, Class<? extends Annotation> annotation) {
@@ -122,17 +111,26 @@
}
private boolean isPrototype(Class<?> clazz) {
- return clazz.getAnnotation(Singleton.class) == null && clazz.getAnnotation(Component.class) == null;
+ return !findSingleton(clazz);
+ }
+
+ private boolean findSingleton(Class clazz) {
+ for (Class<?> singletonAnnotation : Extensions.singletons) {
+ if (clazz.getAnnotation(singletonAnnotation) != null) {
+ return true;
+ }
+ }
+ return false;
}
public void resolve(Matcher matcher) {
resolveArguments(matcher);
- resolveFiields(matcher);
+ resolveFields(matcher);
resolveMethods(matcher);
}
private void resolveMethods(Matcher matcher) {
- for (Method method : new Introspector(clazz).methodsWith(Value.class, Autowired.class, Inject.class)) {
+ for (Method method : new Introspector(clazz).methodsWith(AnnotationHelper.injectDependencyAnnotations)) {
Property prop = Property.create(matcher, method);
if (prop != null) {
properties.add(prop);
@@ -140,8 +138,8 @@
}
}
- private void resolveFiields(Matcher matcher) {
- for (Field field : new Introspector(clazz).fieldsWith(Value.class, Autowired.class, Inject.class)) {
+ private void resolveFields(Matcher matcher) {
+ for (Field field : new Introspector(clazz).fieldsWith(AnnotationHelper.injectDependencyAnnotations)) {
Property prop = Property.create(matcher, field);
if (prop != null) {
properties.add(prop);
@@ -152,30 +150,32 @@
protected void resolveArguments(Matcher matcher) {
Constructor<?>[] declaredConstructors = clazz.getDeclaredConstructors();
for (Constructor constructor : declaredConstructors) {
- Annotation inject = constructor.getAnnotation(Inject.class);
- Annotation autowired = constructor.getAnnotation(Autowired.class);
- if (inject != null || autowired != null || declaredConstructors.length == 1) {
+ if (declaredConstructors.length == 1 || shouldInject(constructor)) {
resolveArguments(matcher, constructor.getParameterTypes(), constructor.getParameterAnnotations());
break;
}
}
}
+ private boolean shouldInject(AnnotatedElement annotatedElement) {
+ for (InjectLikeHandler injectLikeHandler : Extensions.beanInjectLikeHandlers) {
+ if (annotatedElement.getAnnotation(injectLikeHandler.getAnnotation()) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
protected void resolveArguments(Matcher matcher, Class[] parameterTypes, Annotation[][] parameterAnnotations) {
for (int i = 0; i < parameterTypes.length; ++i) {
Annotation[] annotations = parameterAnnotations[i];
+ String value = findValue(annotations);
String ref = null;
- String value = null;
- Value valueAnnotation = findAnnotation(annotations, Value.class);
+
OsgiService osgiServiceAnnotation = findAnnotation(annotations, OsgiService.class);
-
- if (valueAnnotation != null) {
- value = valueAnnotation.value();
- }
-
if (osgiServiceAnnotation != null) {
- Named namedAnnotation = findAnnotation(annotations, Named.class);
- ref = namedAnnotation != null ? namedAnnotation.value() : getBeanNameFromSimpleName(parameterTypes[i].getSimpleName());
+ String name = findName(annotations);
+ ref = name != null ? name : getBeanNameFromSimpleName(parameterTypes[i].getSimpleName());
OsgiServiceRef osgiServiceRef = new OsgiServiceRef(parameterTypes[i], osgiServiceAnnotation, ref);
serviceRefs.add(osgiServiceRef);
}
@@ -187,9 +187,9 @@
if (bean != null) {
ref = bean.id;
} else {
- Named namedAnnotation = findAnnotation(annotations, Named.class);
- if (namedAnnotation != null) {
- ref = namedAnnotation.value();
+ String name = findName(annotations);
+ if (name != null) {
+ ref = name;
} else {
ref = getBeanName(parameterTypes[i]);
}
@@ -200,15 +200,6 @@
}
}
- private static <T> T findAnnotation(Annotation[] annotations, Class<T> annotation) {
- for (Annotation a : annotations) {
- if (a.annotationType() == annotation) {
- return annotation.cast(a);
- }
- }
- return null;
- }
-
@Override
public String toString() {
return clazz.getName();
@@ -226,7 +217,6 @@
}
}
-
public boolean needFieldInjection() {
for (Property property : properties) {
if (property.isField) {
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java
index 585a5bf..d782d9d 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java
@@ -18,9 +18,9 @@
*/
package org.apache.aries.blueprint.plugin.model;
-import org.springframework.stereotype.Component;
+import org.apache.aries.blueprint.plugin.Extensions;
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
-import javax.inject.Named;
import javax.inject.Qualifier;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
@@ -78,16 +78,16 @@
}
public static String getBeanName(Class<?> clazz, AnnotatedElement annotatedElement) {
- Component component = annotatedElement.getAnnotation(Component.class);
- Named named = annotatedElement.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);
+ for (NamedLikeHandler namedLikeHandler : Extensions.namedLikeHandlers) {
+ if (annotatedElement.getAnnotation(namedLikeHandler.getAnnotation()) != null) {
+ String name = namedLikeHandler.getName(clazz, annotatedElement);
+ if (name != null) {
+ return name;
+ }
+ }
}
+ String name = clazz.getSimpleName();
+ return getBeanNameFromSimpleName(name);
}
protected static String getBeanNameFromSimpleName(String name) {
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
index ccba7ec..c94ebc7 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Context.java
@@ -26,8 +26,6 @@
import org.osgi.service.blueprint.container.Converter;
import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-import javax.inject.Singleton;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -79,17 +77,16 @@
private void addProducedBeans(BeanRef factoryBean) {
for (Method method : factoryBean.clazz.getMethods()) {
Produces produces = method.getAnnotation(Produces.class);
- Named named = method.getAnnotation(Named.class);
- Singleton singleton = method.getAnnotation(Singleton.class);
+ String name = AnnotationHelper.findName(method.getAnnotations());
if (produces != null) {
Class<?> producedClass = method.getReturnType();
ProducedBean producedBean;
- if (named != null) {
- producedBean = new ProducedBean(producedClass, named.value(), factoryBean, method);
+ if (name != null) {
+ producedBean = new ProducedBean(producedClass, name, factoryBean, method);
} else {
producedBean = new ProducedBean(producedClass, factoryBean, method);
}
- if (singleton != null) {
+ if (AnnotationHelper.findSingletons(method.getAnnotations())) {
producedBean.setSingleton();
}
reg.add(producedBean);
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ExtensionTransactionFactory.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ExtensionTransactionFactory.java
new file mode 100644
index 0000000..f9435ec
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ExtensionTransactionFactory.java
@@ -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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.apache.aries.blueprint.plugin.spi.TransactionalFactory;
+
+import java.lang.annotation.Annotation;
+
+public class ExtensionTransactionFactory<A extends Annotation> extends AbstractTransactionalFactory<A> {
+
+ private final TransactionalFactory<A> transactionalFactory;
+
+ public ExtensionTransactionFactory(TransactionalFactory<A> transactionalFactory) {
+ this.transactionalFactory = transactionalFactory;
+ }
+
+ @Override
+ public String getTransactionTypeName(A transactional) {
+ return transactionalFactory.getTransactionTypeName(transactional);
+ }
+
+ @Override
+ public Class<A> getTransactionalClass() {
+ return transactionalFactory.getTransactionalClass();
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceRef.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceRef.java
index 0a44931..7a70cde 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceRef.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/OsgiServiceRef.java
@@ -18,10 +18,10 @@
*/
package org.apache.aries.blueprint.plugin.model;
+import org.apache.aries.blueprint.plugin.Extensions;
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
import org.ops4j.pax.cdi.api.OsgiService;
-import org.springframework.stereotype.Component;
-import javax.inject.Named;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -61,10 +61,15 @@
}
private boolean shouldAddSuffix(AnnotatedElement annotatedElement) {
- Component component = annotatedElement.getAnnotation(Component.class);
- Named named = annotatedElement.getAnnotation(Named.class);
- return (component == null || "".equals(component.value())) &&
- (named == null || "".equals(named.value()));
+ for (NamedLikeHandler namedLikeHandler : Extensions.namedLikeHandlers) {
+ if (annotatedElement.getAnnotation(namedLikeHandler.getAnnotation()) != null) {
+ String name = namedLikeHandler.getName(clazz, annotatedElement);
+ if (name != null) {
+ return false;
+ }
+ }
+ }
+ return true;
}
public OsgiServiceRef(Method method) {
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ProducedBean.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ProducedBean.java
index 89e0936..d9a597a 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ProducedBean.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/ProducedBean.java
@@ -19,7 +19,8 @@
package org.apache.aries.blueprint.plugin.model;
-import org.apache.aries.blueprint.plugin.Activation;
+import org.apache.aries.blueprint.plugin.Extensions;
+import org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver;
import java.lang.reflect.Method;
@@ -29,32 +30,25 @@
private Method producingMethod;
public ProducedBean(Class<?> clazz, BeanRef factoryBean, Method factoryMethod) {
- this(clazz, null, factoryBean,factoryMethod);
+ this(clazz, null, factoryBean, factoryMethod);
}
public ProducedBean(Class<?> clazz, String id, BeanRef factoryBean, Method factoryMethod) {
super(clazz);
- if(id != null) {
+ if (id != null) {
this.id = id;
}
this.factoryBean = factoryBean;
this.factoryMethod = factoryMethod.getName();
this.producingMethod = factoryMethod;
- overrideActivationIfNeeded(factoryMethod);
- overrideDependsOnIfNeeded(factoryMethod);
+ resolveBeanAttributes();
}
- private void overrideActivationIfNeeded(Method factoryMethod) {
- Activation methodActivation = getActivation(factoryMethod);
- if (methodActivation != null) {
- this.activation = methodActivation;
- }
- }
-
- private void overrideDependsOnIfNeeded(Method factoryMethod) {
- String dependsOn = getDependsOn(factoryMethod);
- if (dependsOn != null) {
- this.dependsOn = dependsOn;
+ private void resolveBeanAttributes() {
+ for (BeanAttributesResolver beanAttributesResolver : Extensions.beanAttributesResolvers) {
+ if (producingMethod.getAnnotation(beanAttributesResolver.getAnnotation()) != null) {
+ attributes.putAll(beanAttributesResolver.resolveAttributes(clazz, producingMethod));
+ }
}
}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
index 18635a0..60776fa 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Property.java
@@ -18,12 +18,9 @@
*/
package org.apache.aries.blueprint.plugin.model;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
+import org.apache.aries.blueprint.plugin.Extensions;
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
-import javax.inject.Inject;
-import javax.inject.Named;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -42,13 +39,14 @@
}
public static Property create(Matcher matcher, Field field) {
- Value value = field.getAnnotation(Value.class);
if (needsInject(field)) {
+ String value = AnnotationHelper.findValue(field.getAnnotations());
+ if (value != null) {
+ return new Property(field.getName(), null, value, true);
+ }
BeanRef matching = matcher.getMatching(new BeanRef(field));
String ref = (matching == null) ? getRefName(field) : matching.id;
return new Property(field.getName(), ref, null, true);
- } else if (value != null) {
- return new Property(field.getName(), null, cleanValue(value.value()), true);
} else {
// Field is not a property
return null;
@@ -61,9 +59,9 @@
return null;
}
- Value value = method.getAnnotation(Value.class);
+ String value = AnnotationHelper.findValue(method.getAnnotations());
if (value != null) {
- return new Property(propertyName, null, cleanValue(value.value()), false);
+ return new Property(propertyName, null, value, false);
}
if (needsInject(method)) {
@@ -86,33 +84,29 @@
/**
* 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);
- if (named != null) {
- return named.value();
- }
- Qualifier qualifier = field.getAnnotation(Qualifier.class);
- if (qualifier != null) {
- return qualifier.value();
+ for (NamedLikeHandler namedLikeHandler : Extensions.namedLikeHandlers) {
+ if (field.getAnnotation(namedLikeHandler.getAnnotation()) != null) {
+ String name = namedLikeHandler.getName(field.getType(), field);
+ if (name != null) {
+ return name;
+ }
+ }
}
return Bean.getBeanName(field.getType());
}
private static boolean needsInject(AnnotatedElement annotatedElement) {
- return annotatedElement.getAnnotation(Autowired.class) != null || annotatedElement.getAnnotation(Inject.class) != null;
- }
-
- /**
- * Remove default value definition
- *
- * @param value
- * @return
- */
- private static String cleanValue(String value) {
- return value.replaceAll("\\:.*\\}", "}");
+ for (Class injectDependencyAnnotation : AnnotationHelper.injectDependencyAnnotations) {
+ if (annotatedElement.getAnnotation(injectDependencyAnnotation) != null) {
+ return true;
+ }
+ }
+ return false;
}
@Override
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java
index 2468828..91de12b 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/PropertyWriter.java
@@ -18,7 +18,6 @@
*/
package org.apache.aries.blueprint.plugin.model;
-
public interface PropertyWriter {
void writeProperty(Property property);
}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/BeanAttributesResolver.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/BeanAttributesResolver.java
new file mode 100644
index 0000000..9c7bfc9
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/BeanAttributesResolver.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Map;
+
+public interface BeanAttributesResolver<A extends Annotation> {
+ Class<A> getAnnotation();
+
+ Map<String, String> resolveAttributes(Class<?> clazz, AnnotatedElement annotatedElement);
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/BeanFinder.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/BeanFinder.java
new file mode 100644
index 0000000..fceda92
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/BeanFinder.java
@@ -0,0 +1,27 @@
+/**
+ * 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.spi;
+
+import java.lang.annotation.Annotation;
+
+public interface BeanFinder<A extends Annotation> {
+ Class<A> beanAnnotation();
+
+ boolean isSingleton();
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/InjectLikeHandler.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/InjectLikeHandler.java
new file mode 100644
index 0000000..68ccd7d
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/InjectLikeHandler.java
@@ -0,0 +1,25 @@
+/**
+ * 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.spi;
+
+import java.lang.annotation.Annotation;
+
+public interface InjectLikeHandler<A extends Annotation> {
+ Class<A> getAnnotation();
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/NamedLikeHandler.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/NamedLikeHandler.java
new file mode 100644
index 0000000..f71eae1
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/NamedLikeHandler.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spi;
+
+import java.lang.reflect.AnnotatedElement;
+
+public interface NamedLikeHandler {
+ Class getAnnotation();
+
+ String getName(Class clazz, AnnotatedElement annotatedElement);
+
+ String getName(Object annotation);
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/TransactionalFactory.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/TransactionalFactory.java
new file mode 100644
index 0000000..694dbf9
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/TransactionalFactory.java
@@ -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.spi;
+
+import java.lang.annotation.Annotation;
+
+public interface TransactionalFactory<A extends Annotation> {
+ /**
+ * @param transactional the transactional annotation.
+ * @return the blueprint-compatible name of the transaction type.
+ */
+ String getTransactionTypeName(A transactional);
+
+ /**
+ * @return the annotation class to search for.
+ */
+ Class<A> getTransactionalClass();
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/ValueInjectionHandler.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/ValueInjectionHandler.java
new file mode 100644
index 0000000..3e0e871
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spi/ValueInjectionHandler.java
@@ -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.spi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+
+public interface ValueInjectionHandler<A extends Annotation> {
+ Class<A> getAnnotation();
+
+ String getValue(Class clazz, AnnotatedElement annotatedElement);
+
+ String getValue(Object annotation);
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/AutowiredAsInject.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/AutowiredAsInject.java
new file mode 100644
index 0000000..fa806df
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/AutowiredAsInject.java
@@ -0,0 +1,29 @@
+/**
+ * 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.spring;
+
+import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AutowiredAsInject implements InjectLikeHandler<Autowired> {
+ @Override
+ public Class<Autowired> getAnnotation() {
+ return Autowired.class;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ComponentAsNamed.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ComponentAsNamed.java
new file mode 100644
index 0000000..099f7e9
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ComponentAsNamed.java
@@ -0,0 +1,49 @@
+/**
+ * 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.spring;
+
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.AnnotatedElement;
+
+public class ComponentAsNamed implements NamedLikeHandler {
+ @Override
+ public Class getAnnotation() {
+ return Component.class;
+ }
+
+ @Override
+ public String getName(Class clazz, AnnotatedElement annotatedElement) {
+ Component annotation = annotatedElement.getAnnotation(Component.class);
+ if (annotation != null && annotation.value() != null && !"".equals(annotation.value())) {
+ return annotation.value();
+ }
+ return null;
+ }
+
+ @Override
+ public String getName(Object annotation) {
+ Component component = Component.class.cast(annotation);
+ if (component != null && component.value() != null && !"".equals(component.value())) {
+ return component.value();
+ }
+ return null;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ComponentBeanFinder.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ComponentBeanFinder.java
new file mode 100644
index 0000000..b1df9b0
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ComponentBeanFinder.java
@@ -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.spring;
+
+import org.apache.aries.blueprint.plugin.spi.BeanFinder;
+import org.springframework.stereotype.Component;
+
+public class ComponentBeanFinder implements BeanFinder<Component> {
+
+ @Override
+ public Class<Component> beanAnnotation() {
+ return Component.class;
+ }
+
+ @Override
+ public boolean isSingleton() {
+ return true;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/DependsOnAttributeResolver.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/DependsOnAttributeResolver.java
new file mode 100644
index 0000000..62b86cf
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/DependsOnAttributeResolver.java
@@ -0,0 +1,47 @@
+/**
+ * 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.spring;
+
+import org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.context.annotation.DependsOn;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.HashMap;
+import java.util.Map;
+
+public class DependsOnAttributeResolver implements BeanAttributesResolver<DependsOn> {
+ @Override
+ public Class<DependsOn> getAnnotation() {
+ return DependsOn.class;
+ }
+
+ @Override
+ public Map<String, String> resolveAttributes(Class<?> clazz, AnnotatedElement annotatedElement) {
+ DependsOn annotation = annotatedElement.getAnnotation(DependsOn.class);
+ if (annotation == null || annotation.value().length == 0) {
+ return new HashMap<>();
+ }
+ String[] value = annotation.value();
+ String dependsOnValue = StringUtils.join(value, " ");
+ Map<String, String> map = new HashMap<>();
+ map.put("depends-on", dependsOnValue);
+ return map;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/LazyAttributeResolver.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/LazyAttributeResolver.java
new file mode 100644
index 0000000..07d5393
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/LazyAttributeResolver.java
@@ -0,0 +1,41 @@
+/**
+ * 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.spring;
+
+import org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver;
+import org.springframework.context.annotation.Lazy;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.HashMap;
+import java.util.Map;
+
+public class LazyAttributeResolver implements BeanAttributesResolver<Lazy> {
+ @Override
+ public Class<Lazy> getAnnotation() {
+ return Lazy.class;
+ }
+
+ @Override
+ public Map<String, String> resolveAttributes(Class<?> clazz, AnnotatedElement annotatedElement) {
+ Lazy lazy = annotatedElement.getAnnotation(Lazy.class);
+ Map<String, String> map = new HashMap<>();
+ map.put("activation", lazy.value() ? "lazy" : "eager");
+ return map;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/QualifierAsNamed.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/QualifierAsNamed.java
new file mode 100644
index 0000000..4779b03
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/QualifierAsNamed.java
@@ -0,0 +1,49 @@
+/**
+ * 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.spring;
+
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
+import org.springframework.beans.factory.annotation.Qualifier;
+
+import java.lang.reflect.AnnotatedElement;
+
+public class QualifierAsNamed implements NamedLikeHandler {
+ @Override
+ public Class getAnnotation() {
+ return Qualifier.class;
+ }
+
+ @Override
+ public String getName(Class clazz, AnnotatedElement annotatedElement) {
+ Qualifier annotation = annotatedElement.getAnnotation(Qualifier.class);
+ if (annotation != null && annotation.value() != null && !"".equals(annotation.value())) {
+ return annotation.value();
+ }
+ return null;
+ }
+
+ @Override
+ public String getName(Object annotation) {
+ Qualifier qualifier = Qualifier.class.cast(annotation);
+ if (qualifier != null && qualifier.value() != null && !"".equals(qualifier.value())) {
+ return qualifier.value();
+ }
+ return null;
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/SpringTransactionalFactory.java
similarity index 83%
rename from blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java
rename to blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/SpringTransactionalFactory.java
index 7f07ab5..13a82a0 100644
--- a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/SpringTransactionFactory.java
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/SpringTransactionalFactory.java
@@ -16,17 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.aries.blueprint.plugin.model;
+package org.apache.aries.blueprint.plugin.spring;
+import com.google.common.base.CaseFormat;
+import org.apache.aries.blueprint.plugin.spi.TransactionalFactory;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
-import com.google.common.base.CaseFormat;
-
-public class SpringTransactionFactory extends AbstractTransactionalFactory<Transactional> {
+public class SpringTransactionalFactory implements TransactionalFactory<Transactional> {
@Override
- public String getTransactionTypeName(Transactional transactional)
- {
+ public String getTransactionTypeName(Transactional transactional) {
Propagation propagation = transactional.propagation();
if (propagation == Propagation.NESTED) {
throw new UnsupportedOperationException("Nested transactions not supported");
@@ -35,8 +34,7 @@
}
@Override
- public Class<Transactional> getTransactionalClass()
- {
+ public Class<Transactional> getTransactionalClass() {
return Transactional.class;
}
}
diff --git a/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ValueInjectionHandler.java b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ValueInjectionHandler.java
new file mode 100644
index 0000000..8f87969
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/spring/ValueInjectionHandler.java
@@ -0,0 +1,43 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.spring;
+
+import org.springframework.beans.factory.annotation.Value;
+
+import java.lang.reflect.AnnotatedElement;
+
+public class ValueInjectionHandler implements org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler<Value> {
+
+ @Override
+ public Class<Value> getAnnotation() {
+ return Value.class;
+ }
+
+ @Override
+ public String getValue(Class clazz, AnnotatedElement annotatedElement) {
+ Value annotation = annotatedElement.getAnnotation(Value.class);
+ return annotation.value().replaceAll("\\:.*\\}", "}");
+ }
+
+ @Override
+ public String getValue(Object annotation) {
+ Value value = Value.class.cast(annotation);
+ return value.value().replaceAll("\\:.*\\}", "}");
+ }
+}
diff --git a/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver
new file mode 100644
index 0000000..663339e
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.BeanAttributesResolver
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.apache.aries.blueprint.plugin.spring.LazyAttributeResolver
+org.apache.aries.blueprint.plugin.spring.DependsOnAttributeResolver
\ No newline at end of file
diff --git a/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.BeanFinder b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.BeanFinder
new file mode 100644
index 0000000..e3cf078
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.BeanFinder
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+org.apache.aries.blueprint.plugin.spring.ComponentBeanFinder
+org.apache.aries.blueprint.plugin.javax.SingletonBeanFinder
+org.apache.aries.blueprint.plugin.javax.NamedBeanFinder
\ No newline at end of file
diff --git a/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.InjectLikeHandler b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.InjectLikeHandler
new file mode 100644
index 0000000..c9a82a7
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.InjectLikeHandler
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.apache.aries.blueprint.plugin.spring.AutowiredAsInject
+org.apache.aries.blueprint.plugin.javax.InjectHandler
\ No newline at end of file
diff --git a/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.NamedLikeHandler b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.NamedLikeHandler
new file mode 100644
index 0000000..7a283c1
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.NamedLikeHandler
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+org.apache.aries.blueprint.plugin.spring.ComponentAsNamed
+org.apache.aries.blueprint.plugin.spring.QualifierAsNamed
+org.apache.aries.blueprint.plugin.javax.NamedHandler
\ No newline at end of file
diff --git a/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.TransactionalFactory b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.TransactionalFactory
new file mode 100644
index 0000000..f16911a
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.TransactionalFactory
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+org.apache.aries.blueprint.plugin.spring.SpringTransactionalFactory
+org.apache.aries.blueprint.plugin.javax.JavaxTransactionFactory
\ No newline at end of file
diff --git a/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler
new file mode 100644
index 0000000..fd85759
--- /dev/null
+++ b/blueprint/blueprint-maven-plugin/src/main/resources/META-INF/services/org.apache.aries.blueprint.plugin.spi.ValueInjectionHandler
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.apache.aries.blueprint.plugin.spring.ValueInjectionHandler
\ No newline at end of file