Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B781E2004C8 for ; Mon, 9 May 2016 16:48:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B696C16099C; Mon, 9 May 2016 14:48:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2921F160A10 for ; Mon, 9 May 2016 16:48:22 +0200 (CEST) Received: (qmail 79161 invoked by uid 500); 9 May 2016 14:48:21 -0000 Mailing-List: contact commits-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@karaf.apache.org Delivered-To: mailing list commits@karaf.apache.org Received: (qmail 79044 invoked by uid 99); 9 May 2016 14:48:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 May 2016 14:48:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 1C9C2E108B; Mon, 9 May 2016 14:48:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cschneider@apache.org To: commits@karaf.apache.org Date: Mon, 09 May 2016 14:48:24 -0000 Message-Id: <6079b17ae8434eccb759f37f528dd42f@git.apache.org> In-Reply-To: <1e3eeb57e42d4f938950e5b22b1cb7f9@git.apache.org> References: <1e3eeb57e42d4f938950e5b22b1cb7f9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [05/35] karaf-boot git commit: Refactoring of karaf-boot archived-at: Mon, 09 May 2016 14:48:25 -0000 http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Bean.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Bean.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Bean.java deleted file mode 100644 index 995649c..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Bean.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.persistence.PersistenceContext; -import javax.persistence.PersistenceUnit; - -public class Bean extends BeanRef { - public String initMethod; - public String destroyMethod; - public SortedSet properties; - public Field[] persistenceFields; - public TransactionalDef transactionDef; - - public Bean(Class clazz) { - super(clazz); - - for (Method method : clazz.getDeclaredMethods()) { - PostConstruct postConstruct = getEffectiveAnnotation(method, PostConstruct.class); - if (postConstruct != null) { - this.initMethod = method.getName(); - } - PreDestroy preDestroy = getEffectiveAnnotation(method, PreDestroy.class); - if (preDestroy != null) { - this.destroyMethod = method.getName(); - } - } - this.persistenceFields = getPersistenceFields(); - this.transactionDef = new JavaxTransactionFactory().create(clazz); - if (this.transactionDef == null) { - this.transactionDef = new SpringTransactionFactory().create(clazz); - } - properties = new TreeSet(); - } - - private Field[] getPersistenceFields() { - List persistenceFields = new ArrayList(); - Field[] fields = clazz.getDeclaredFields(); - for (Field field : fields) { - PersistenceContext persistenceContext = field.getAnnotation(PersistenceContext.class); - PersistenceUnit persistenceUnit = field.getAnnotation(PersistenceUnit.class); - if (persistenceContext !=null || persistenceUnit != null) { - persistenceFields.add(field); - } - } - return persistenceFields.toArray(new Field[]{}); - } - - public void resolve(Matcher matcher) { - Class curClass = this.clazz; - while (curClass != null && 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); - } - } - } - - private static T getEffectiveAnnotation(Method method, Class annotationClass) { - final Class methodClass = method.getDeclaringClass(); - final String name = method.getName(); - final Class[] params = method.getParameterTypes(); - - // 1. Current class - final T rootAnnotation = method.getAnnotation(annotationClass); - if (rootAnnotation != null) { - return rootAnnotation; - } - - // 2. Superclass - final Class superclass = methodClass.getSuperclass(); - if (superclass != null) { - final T annotation = getMethodAnnotation(superclass, name, params, annotationClass); - if (annotation != null) - return annotation; - } - - // 3. Interfaces - for (final Class intfs : methodClass.getInterfaces()) { - final T annotation = getMethodAnnotation(intfs, name, params, annotationClass); - if (annotation != null) - return annotation; - } - - return null; - } - - private static T getMethodAnnotation(Class searchClass, String name, Class[] params, - Class annotationClass) { - try { - Method method = searchClass.getMethod(name, params); - return getEffectiveAnnotation(method, annotationClass); - } catch (NoSuchMethodException e) { - return null; - } - } - - - @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); - } - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanRef.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanRef.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanRef.java deleted file mode 100644 index ba67f33..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanRef.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.apache.karaf.boot.tools.maven.plugin.model; - -import java.lang.reflect.Field; - -import javax.inject.Named; - -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -public class BeanRef implements Comparable { - public String id; - public Class clazz; - - /** - * - * @param clazz interface or implementation class - */ - public BeanRef(Class clazz) { - this.clazz = clazz; - this.id = getBeanName(clazz); - } - - public BeanRef(Class type, String id) { - this.clazz = type; - this.id = id; - } - - public BeanRef(Field field) { - this(field.getType(), getDestinationId(field)); - } - - private static String getDestinationId(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(); - } - return null; - } - - 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(BeanRef template) { - boolean assignable = template.clazz.isAssignableFrom(this.clazz); - return assignable && ((template.id == null) || id.equals(template.id)); - } - - public int compareTo(BeanRef other) { - return this.id.compareTo(other.id); - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Context.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Context.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Context.java deleted file mode 100644 index 442bc6e..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Context.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.SortedSet; -import java.util.TreeSet; - -import javax.enterprise.inject.Produces; - -import org.ops4j.pax.cdi.api.OsgiService; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.service.blueprint.container.BlueprintContainer; -import org.osgi.service.blueprint.container.Converter; - -public class Context implements Matcher { - - SortedSet beans; - SortedSet serviceRefs; - - public Context(Class... beanClasses) { - this(Arrays.asList(beanClasses)); - } - - public Context(Collection> beanClasses) { - this.beans = new TreeSet(); - this.serviceRefs = new TreeSet(); - addBeans(beanClasses); - } - - private void addBeans(Collection> beanClasses) { - for (Class clazz : beanClasses) { - Bean bean = new Bean(clazz); - beans.add(bean); - addServiceRefs(clazz); - addProducedBeans(clazz, bean.id); - } - } - - private void addProducedBeans(Class clazz, String factoryBeanId) { - for (Method method : clazz.getMethods()) { - Produces produces = method.getAnnotation(Produces.class); - if (produces != null) { - Class producedClass = method.getReturnType(); - ProducedBean producedBean = new ProducedBean(producedClass, factoryBeanId, method.getName()); - beans.add(producedBean); - } - } - } - - private void addServiceRefs(Class clazz) { - for (Field field : clazz.getDeclaredFields()) { - OsgiService osgiService = field.getAnnotation(OsgiService.class); - if (osgiService != null) { - serviceRefs.add(new OsgiServiceRef(field)); - } - } - } - - public void resolve() { - for (Bean bean : beans) { - bean.resolve(this); - } - } - - public BeanRef getMatching(BeanRef template) { - for (Bean bean : beans) { - if (bean.matches(template)) { - return bean; - } - } - for (BeanRef bean : serviceRefs) { - if (bean.matches(template)) { - return bean; - } - } - if (template.clazz == BundleContext.class) { - return new BeanRef(BundleContext.class, "blueprintBundleContext"); - } - if (template.clazz == Bundle.class) { - return new BeanRef(Bundle.class, "blueprintBundle"); - } - if (template.clazz == BlueprintContainer.class) { - return new BeanRef(BlueprintContainer.class, "blueprintContainer"); - } - if (template.clazz == Converter.class) { - return new BeanRef(Converter.class, "blueprintConverter"); - } - - return null; - } - - public SortedSet getBeans() { - return beans; - } - - public SortedSet getServiceRefs() { - return serviceRefs; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/JavaxTransactionFactory.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/JavaxTransactionFactory.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/JavaxTransactionFactory.java deleted file mode 100644 index c00a54c..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/JavaxTransactionFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import java.util.HashMap; - -import javax.transaction.Transactional; -import javax.transaction.Transactional.TxType; - -public class JavaxTransactionFactory { - private static HashMap txTypeNames; - - static { - txTypeNames = new HashMap(); - 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; - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Matcher.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Matcher.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Matcher.java deleted file mode 100644 index f703ed1..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Matcher.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -public interface Matcher { - BeanRef getMatching(BeanRef template); -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/OsgiServiceRef.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/OsgiServiceRef.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/OsgiServiceRef.java deleted file mode 100644 index 5069663..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/OsgiServiceRef.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import java.lang.reflect.Field; - -import org.ops4j.pax.cdi.api.OsgiService; - -/** - * Synthetic bean that refers to an OSGi service - */ -public class OsgiServiceRef extends BeanRef { - - public String filter; - - public OsgiServiceRef(Field field) { - super(field); - if (id == null) { - id = getBeanName(clazz); - } - OsgiService osgiService = field.getAnnotation(OsgiService.class); - filter = osgiService.filter(); - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/ProducedBean.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/ProducedBean.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/ProducedBean.java deleted file mode 100644 index b5e8b11..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/ProducedBean.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.apache.karaf.boot.tools.maven.plugin.model; - -public class ProducedBean extends Bean { - public String factoryMethod; - public String factoryBeanId; - - public ProducedBean(Class clazz, String factoryBeanId, String factoryMethod) { - super(clazz); - this.factoryBeanId = factoryBeanId; - this.factoryMethod = factoryMethod; - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Property.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Property.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Property.java deleted file mode 100644 index 4ec7e5a..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/Property.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.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.Qualifier; -import org.springframework.beans.factory.annotation.Value; - -public class Property implements Comparable { - 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)) { - BeanRef matching = matcher.getMatching(new BeanRef(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); - if (named != null) { - return named.value(); - } - Qualifier qualifier = field.getAnnotation(Qualifier.class); - if (qualifier != null) { - return qualifier.value(); - } - return 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("\\:.*\\}", "}"); - } - - public int compareTo(Property other) { - return name.compareTo(other.name); - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyWriter.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyWriter.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyWriter.java deleted file mode 100644 index e8e6bda..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyWriter.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -public interface PropertyWriter { - void writeProperty(Property property); -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/SpringTransactionFactory.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/SpringTransactionFactory.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/SpringTransactionFactory.java deleted file mode 100644 index 4d65261..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/SpringTransactionFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import java.util.HashMap; - -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -public class SpringTransactionFactory { - private static HashMap txTypeNames; - - static { - txTypeNames = new HashMap(); - 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; - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/TransactionalDef.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/TransactionalDef.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/TransactionalDef.java deleted file mode 100644 index 7be6a67..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/java/org/apache/karaf/boot/tools/maven/plugin/model/TransactionalDef.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.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; - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/main/resources/META-INF/plexus/components.xml ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000..6fa2eeb --- /dev/null +++ b/karaf-boot-tools/karaf-boot-maven-plugin/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,61 @@ + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + jar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + org.apache.maven.plugins:maven-resources-plugin:resources + org.apache.maven.plugins:maven-compiler-plugin:compile + org.apache.karaf.boot:karaf-boot-maven-plugin:generate + org.apache.maven.plugins:maven-resources-plugin:testResources + org.apache.maven.plugins:maven-compiler-plugin:testCompile + org.apache.maven.plugins:maven-surefire-plugin:test + + org.apache.maven.plugins:maven-install-plugin:install + + + org.apache.maven.plugins:maven-deploy-plugin:deploy + + + + + + + + org.apache.maven.artifact.handler.ArtifactHandler + bundle + org.apache.maven.artifact.handler.DefaultArtifactHandler + + jar + false + java + jar + true + jar + + + + http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/GeneratorTest.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/GeneratorTest.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/GeneratorTest.java deleted file mode 100644 index ff009b3..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/GeneratorTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin; - -import static java.util.Arrays.asList; -import static org.apache.karaf.boot.tools.maven.plugin.FilteredClassFinder.findClasses; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Set; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; - -import org.apache.karaf.boot.tools.maven.plugin.model.Context; -import org.apache.karaf.boot.tools.maven.plugin.test.MyBean1; -import org.apache.commons.io.output.ByteArrayOutputStream; -import org.apache.xbean.finder.ClassFinder; -import org.junit.Assert; -import org.junit.Test; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; - -public class GeneratorTest { - - private XPath xpath; - private Document document; - - @Test - public void testGenerate() throws Exception { - ClassFinder classFinder = new ClassFinder(this.getClass().getClassLoader()); - String packageName = MyBean1.class.getPackage().getName(); - Set> beanClasses = findClasses(classFinder, asList(packageName)); - Context context = new Context(beanClasses); - context.resolve(); - ByteArrayOutputStream os = new ByteArrayOutputStream(); - new Generator(context, os, false).generate(); - System.out.println(os.toString("UTF-8")); - - document = readToDocument(os); - xpath = XPathFactory.newInstance().newXPath(); - //xpath.setNamespaceContext(new NameSpaces(document)); - Node bean1 = (Node) xpath.evaluate("/blueprint/bean[@id='myBean1']", document, XPathConstants.NODE); - - // Bean - Assert.assertEquals(MyBean1.class.getName(), xpath.evaluate("@class", bean1)); - Assert.assertEquals("init", xpath.evaluate("@init-method", bean1)); - Assert.assertEquals("destroy", xpath.evaluate("@destroy-method", bean1)); - Assert.assertEquals("true", xpath.evaluate("@field-injection", bean1)); - - // @Transactional - Assert.assertEquals("*", xpath.evaluate("transaction/@method", bean1)); - Assert.assertEquals("Required", xpath.evaluate("transaction/@value", bean1)); - - // @PersistenceContext - Assert.assertEquals("person", xpath.evaluate("context/@unitname", bean1)); - Assert.assertEquals("em", xpath.evaluate("context/@property", bean1)); - - // @PersistenceUnit - Assert.assertEquals("person", xpath.evaluate("unit/@unitname", bean1)); - Assert.assertEquals("emf", xpath.evaluate("unit/@property", bean1)); - - // @Autowired - Assert.assertEquals("my1", xpath.evaluate("property[@name='bean2']/@ref", bean1)); - - - } - - private Document readToDocument(ByteArrayOutputStream os) throws ParserConfigurationException, - SAXException, IOException { - InputStream is = new ByteArrayInputStream(os.toByteArray()); - DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = builderFactory.newDocumentBuilder(); - return builder.parse(is); - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/Namespaces.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/Namespaces.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/Namespaces.java deleted file mode 100644 index c4224ce..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/Namespaces.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin; - -import java.util.Iterator; - -import javax.xml.XMLConstants; -import javax.xml.namespace.NamespaceContext; - -import org.w3c.dom.Document; - - -public class Namespaces implements NamespaceContext { - private Document doc; - - public Namespaces(Document doc) { - this.doc = doc; - } - - @Override - public String getNamespaceURI(String prefix) { - if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) { - return doc.lookupNamespaceURI(null); - } else { - return doc.lookupNamespaceURI(prefix); - } - } - - @Override - public String getPrefix(String namespaceURI) { - return doc.lookupPrefix(namespaceURI); - } - - @Override - public Iterator getPrefixes(String namespaceURI) { - return null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanTest.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanTest.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanTest.java deleted file mode 100644 index 9f6470f..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/BeanTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import javax.inject.Named; - -import org.apache.karaf.boot.tools.maven.plugin.test.MyBean1; -import org.apache.karaf.boot.tools.maven.plugin.test.MyBean3; -import org.apache.karaf.boot.tools.maven.plugin.test.MyBean4; -import org.apache.karaf.boot.tools.maven.plugin.test.ServiceAImpl1; -import org.junit.Assert; -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); - Assert.assertEquals(2, bean.persistenceFields.length); - assertEquals("em", bean.persistenceFields[0].getName()); - assertEquals("emf", bean.persistenceFields[1].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); - assertEquals("There should be no persistence fields", 0, bean.persistenceFields.length); - assertEquals("*", bean.transactionDef.getMethod()); - assertEquals("RequiresNew", bean.transactionDef.getType()); - assertEquals(5, 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); - assertEquals("There should be no persistence fields", 0, bean.persistenceFields.length); - assertNull("There should be no transaction definition", bean.transactionDef); - assertEquals("There should be no properties", 0, bean.properties.size()); - } - - @Test - public void testBlueprintBundleContext() { - Bean bean = new Bean(MyBean4.class); - bean.resolve(new Context()); - Property bcProp = bean.properties.iterator().next(); - assertEquals("bundleContext", bcProp.name); - assertEquals("blueprintBundleContext", bcProp.ref); - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/ContextTest.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/ContextTest.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/ContextTest.java deleted file mode 100644 index e9a1d12..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/ContextTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import static org.junit.Assert.assertEquals; - -import org.apache.karaf.boot.tools.maven.plugin.test.MyBean3; -import org.apache.karaf.boot.tools.maven.plugin.test.MyFactoryBean; -import org.apache.karaf.boot.tools.maven.plugin.test.MyProduced; -import org.apache.karaf.boot.tools.maven.plugin.test.ServiceB; -import org.apache.karaf.boot.tools.maven.plugin.test.ServiceReferences; -import org.junit.Assert; -import org.junit.Test; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.service.blueprint.container.BlueprintContainer; -import org.osgi.service.blueprint.container.Converter; - -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(2, context.getServiceRefs().size()); - } - - @Test - public void testMatching() throws NoSuchFieldException, SecurityException { - Context context = new Context(ServiceReferences.class); - BeanRef matching = context.getMatching(new BeanRef(ServiceB.class)); - Assert.assertEquals(OsgiServiceRef.class, matching.getClass()); - Assert.assertEquals(ServiceB.class, matching.clazz); - Assert.assertEquals("serviceB", matching.id); - } - - private void assertSpecialRef(String expectedId, Class clazz) { - Context context = new Context(); - BeanRef ref = context.getMatching(new BeanRef(clazz)); - assertEquals(expectedId, ref.id); - } - - @Test - public void testSpecialRefs() { - assertSpecialRef("blueprintBundleContext", BundleContext.class); - assertSpecialRef("blueprintBundle", Bundle.class); - assertSpecialRef("blueprintContainer", BlueprintContainer.class); - assertSpecialRef("blueprintConverter", Converter.class); - } - - @Test - public void testProduced() throws NoSuchFieldException, SecurityException { - Context context = new Context(MyFactoryBean.class); - - ProducedBean matching = (ProducedBean)context.getMatching(new BeanRef(MyProduced.class)); - Assert.assertEquals(MyProduced.class, matching.clazz); - Assert.assertEquals("myFactoryBean", matching.factoryBeanId); - Assert.assertEquals("create", matching.factoryMethod); - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyTest.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyTest.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyTest.java deleted file mode 100644 index 772af11..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/PropertyTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import java.lang.reflect.Field; - -import javax.xml.stream.XMLStreamException; - -import org.apache.karaf.boot.tools.maven.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(BeanRef template) { - 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(BeanRef template) { - 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); - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/TestBeanForRef.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/TestBeanForRef.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/TestBeanForRef.java deleted file mode 100644 index 2a96d05..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/model/TestBeanForRef.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.model; - -import javax.inject.Inject; -import javax.inject.Singleton; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceUnit; - -import org.apache.karaf.boot.tools.maven.plugin.test.ServiceA; -import org.apache.karaf.boot.tools.maven.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; -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean1.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean1.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean1.java deleted file mode 100644 index 248578a..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean1.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.test; - -import javax.inject.Singleton; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -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 extends ParentBean { - - @Autowired - ServiceA bean2; - - @PersistenceContext(unitName="person") - EntityManager em; - - @PersistenceUnit(unitName="person") - EntityManager emf; - - public void init() { - } - - public void destroy() { - } - - public void saveData() { - - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean3.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean3.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean3.java deleted file mode 100644 index d96f6c6..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean3.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.test; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.springframework.beans.factory.annotation.Qualifier; -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 - @Qualifier("my2") - ServiceA serviceA2; - - @Inject - ServiceB serviceB; - - @Inject - @Named("serviceB2Id") - ServiceB serviceB2; - - @Inject - MyProduced myProduced; -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean4.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean4.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean4.java deleted file mode 100644 index 83a2244..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyBean4.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.apache.karaf.boot.tools.maven.plugin.test; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.osgi.framework.BundleContext; - -@Singleton -public class MyBean4 { - - @Inject - BundleContext bundleContext; -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyFactoryBean.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyFactoryBean.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyFactoryBean.java deleted file mode 100644 index 6442100..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyFactoryBean.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.apache.karaf.boot.tools.maven.plugin.test; - -import javax.enterprise.inject.Produces; -import javax.inject.Inject; -import javax.inject.Singleton; - -@Singleton -public class MyFactoryBean { - - @Inject - ServiceB serviceB; - - @Produces - public MyProduced create() { - return new MyProduced("My message"); - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyProduced.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyProduced.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyProduced.java deleted file mode 100644 index 9426aea..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/MyProduced.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.apache.karaf.boot.tools.maven.plugin.test; - -import javax.inject.Inject; - -public class MyProduced { - private String message; - - @Inject - ServiceA serviceA; - - public MyProduced(String message) { - this.message = message; - } - - public String getMessage() { - return message; - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ParentBean.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ParentBean.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ParentBean.java deleted file mode 100644 index dc8f515..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ParentBean.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.test; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; - -public class ParentBean { - - @PostConstruct - public void init() { - } - - @PreDestroy - public void destroy() { - } -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceA.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceA.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceA.java deleted file mode 100644 index 1897163..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceA.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.test; - -public interface ServiceA { - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl1.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl1.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl1.java deleted file mode 100644 index 7b6f405..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl1.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.test; - -import javax.inject.Named; -import javax.inject.Singleton; - -@Singleton -@Named("my1") -public class ServiceAImpl1 implements ServiceA { - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl2.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl2.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl2.java deleted file mode 100644 index 5c17339..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceAImpl2.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.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; - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceB.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceB.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceB.java deleted file mode 100644 index e931307..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceB.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * 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.karaf.boot.tools.maven.plugin.test; - -public interface ServiceB { - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceReferences.java ---------------------------------------------------------------------- diff --git a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceReferences.java b/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceReferences.java deleted file mode 100644 index 4824bcb..0000000 --- a/karaf-boot-tools/karaf-boot-maven-plugin/src/test/java/org/apache/karaf/boot/tools/maven/plugin/test/ServiceReferences.java +++ /dev/null @@ -1,33 +0,0 @@ - -/** - * 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.karaf.boot.tools.maven.plugin.test; - -import javax.inject.Inject; -import javax.inject.Named; - -import org.ops4j.pax.cdi.api.OsgiService; -import org.springframework.stereotype.Component; - -@Component -public class ServiceReferences { - @Inject @OsgiService ServiceB serviceB; - - @Named("serviceB2Id") @Inject @OsgiService ServiceB serviceB2; -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/README.md ---------------------------------------------------------------------- diff --git a/karaf-boot/README.md b/karaf-boot/README.md deleted file mode 100644 index d428147..0000000 --- a/karaf-boot/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Karaf Boot Annotations ------------------------ - -Karaf Boot provides annotations allowing you to focus on your business code, and let Karaf Boot deals with all the -plumbing for you. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/pom.xml ---------------------------------------------------------------------- diff --git a/karaf-boot/pom.xml b/karaf-boot/pom.xml deleted file mode 100644 index 22421fa..0000000 --- a/karaf-boot/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.karaf.boot - karaf-boot-build - 1.0.0-SNAPSHOT - ../pom.xml - - - karaf-boot - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/src/main/java/org/apache/karaf/boot/Arg.java ---------------------------------------------------------------------- diff --git a/karaf-boot/src/main/java/org/apache/karaf/boot/Arg.java b/karaf-boot/src/main/java/org/apache/karaf/boot/Arg.java deleted file mode 100644 index 89e7d0f..0000000 --- a/karaf-boot/src/main/java/org/apache/karaf/boot/Arg.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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.karaf.boot; - - -/** - * used to describe argument of the bean constructor - * or the argument of the factory method for the bean - * - * this is mapped to Targument for the Tbean - * - */ -public @interface Arg { - - /** - * the value of the argument - */ - String value() default ""; - - /** - * the value of the ref attribute of the argument - */ - String ref() default ""; - - /** - * the description of the argument - */ - String description() default ""; - - /** - * the zero-based index into the parameter list of the factory method - * or constructor to be invoked for this argument. This is determined by - * specifying the index attribute for the bean. If not - * explicitly set, this will return -1 and the initial ordering is defined - * by its position in the args[] list. - */ - int index() default -1; - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/src/main/java/org/apache/karaf/boot/Bean.java ---------------------------------------------------------------------- diff --git a/karaf-boot/src/main/java/org/apache/karaf/boot/Bean.java b/karaf-boot/src/main/java/org/apache/karaf/boot/Bean.java deleted file mode 100644 index 0a6ebbf..0000000 --- a/karaf-boot/src/main/java/org/apache/karaf/boot/Bean.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * 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.karaf.boot; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/* - * To annotate a bean as a blueprint bean, use @Bean - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface Bean { - - /** - * id, activation, dependsOn comes from Tcomponent - * the id property for the bean - * should this be auto generated if none is specified? - */ - String id(); - - /** - * the activation property for the bean - * This can either be "eager" or "lazy". If not specified, it - * defaults to default-activation attribute of the enclosing - * element. - */ - String activation() default ""; - - /** - * the components that the bean depends on - */ - String[] dependsOn() default ""; - - /** - * the description property for the bean - */ - String description() default ""; - - /** - * the scope property for the bean. value can be prototype or singleton - */ - String scope() default ""; - - /** - * the reference to the factory component on which to invoke the - * factory method for the bean. - */ - String factoryRef() default ""; - - /** - * the factory method in the factoryRef referred factory component - * @return - */ - String factoryMethod() default ""; - - /** - * arguments for the bean constructor or the factory method of the bean - * @return - */ - Arg[] args() default {}; - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/src/main/java/org/apache/karaf/boot/Bind.java ---------------------------------------------------------------------- diff --git a/karaf-boot/src/main/java/org/apache/karaf/boot/Bind.java b/karaf-boot/src/main/java/org/apache/karaf/boot/Bind.java deleted file mode 100644 index f7a3938..0000000 --- a/karaf-boot/src/main/java/org/apache/karaf/boot/Bind.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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.karaf.boot; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * used to annotation bind-method in blueprint reference listeners - * - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Bind { -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/src/main/java/org/apache/karaf/boot/Destroy.java ---------------------------------------------------------------------- diff --git a/karaf-boot/src/main/java/org/apache/karaf/boot/Destroy.java b/karaf-boot/src/main/java/org/apache/karaf/boot/Destroy.java deleted file mode 100644 index a8e1258..0000000 --- a/karaf-boot/src/main/java/org/apache/karaf/boot/Destroy.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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.karaf.boot; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * used to annotation destroy-method in blueprint beans - * - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Destroy { -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/src/main/java/org/apache/karaf/boot/Element.java ---------------------------------------------------------------------- diff --git a/karaf-boot/src/main/java/org/apache/karaf/boot/Element.java b/karaf-boot/src/main/java/org/apache/karaf/boot/Element.java deleted file mode 100644 index 3259c80..0000000 --- a/karaf-boot/src/main/java/org/apache/karaf/boot/Element.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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.karaf.boot; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * used to annotate the element of the list. - * - */ -@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface Element { - ElementType type() default ElementType.STRING; - String value() default ""; - - public enum ElementType { - STRING, - LONG, - BYTE, - BOOLEAN, - INT, - SHORT - } - -} http://git-wip-us.apache.org/repos/asf/karaf-boot/blob/87577122/karaf-boot/src/main/java/org/apache/karaf/boot/Init.java ---------------------------------------------------------------------- diff --git a/karaf-boot/src/main/java/org/apache/karaf/boot/Init.java b/karaf-boot/src/main/java/org/apache/karaf/boot/Init.java deleted file mode 100644 index 437ca8c..0000000 --- a/karaf-boot/src/main/java/org/apache/karaf/boot/Init.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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.karaf.boot; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * used to annotation init-method in blueprint beans - * - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Init { -}