Return-Path: Delivered-To: apmail-openwebbeans-commits-archive@www.apache.org Received: (qmail 46959 invoked from network); 24 Feb 2010 07:34:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Feb 2010 07:34:02 -0000 Received: (qmail 90153 invoked by uid 500); 24 Feb 2010 07:34:02 -0000 Delivered-To: apmail-openwebbeans-commits-archive@openwebbeans.apache.org Received: (qmail 90122 invoked by uid 500); 24 Feb 2010 07:34:02 -0000 Mailing-List: contact commits-help@openwebbeans.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openwebbeans.apache.org Delivered-To: mailing list commits@openwebbeans.apache.org Received: (qmail 90112 invoked by uid 99); 24 Feb 2010 07:34:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 07:34:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2010 07:34:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id ED46F2388900; Wed, 24 Feb 2010 07:33:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r915709 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/util/ test/java/org/apache/webbeans/newtests/specalization/ test/resources/org/... Date: Wed, 24 Feb 2010 07:33:40 -0000 To: commits@openwebbeans.apache.org From: gerdogdu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100224073340.ED46F2388900@eris.apache.org> Author: gerdogdu Date: Wed Feb 24 07:33:40 2010 New Revision: 915709 URL: http://svn.apache.org/viewvc?rev=915709&view=rev Log: [OWB-289] Owb return 2 beans for Indirect specialized producer beans, thanks to YING WANG Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java (with props) openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java (with props) openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/ openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml (with props) Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=915709&r1=915708&r2=915709&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java (original) +++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java Wed Feb 24 07:33:40 2010 @@ -467,7 +467,10 @@ } // XML Defined Specializations - checkXMLSpecializations(); + checkXMLSpecializations(); + + //configure specialized producer beans. + WebBeansUtil.configureProducerMethodSpecializations(); } catch(Exception e) { Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=915709&r1=915708&r2=915709&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java (original) +++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java Wed Feb 24 07:33:40 2010 @@ -412,11 +412,13 @@ //Look for alternative results = findByAlternatives(results); + //Ambigious resulotion, check for specialization if(results.size() > 1) { //Look for specialization results = findBySpecialization(results); + } return results; @@ -437,7 +439,7 @@ while(it.hasNext()) { AbstractOwbBean component = (AbstractOwbBean)it.next(); - if(component.isSpecializedBean()) + if(component.isSpecializedBean() && component.isEnabled()) { res.add(component); } Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java (added) +++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SortedListHelper.java Wed Feb 24 07:33:40 2010 @@ -0,0 +1,61 @@ +/* + * 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.webbeans.util; + +import java.util.List; +import java.util.Comparator; + +public class SortedListHelper { + + List list; + Comparator comparator; + + public SortedListHelper(Listlist, Comparator comparator) + { + this.list = list; + this.comparator = comparator; + } + + public List getList() + { + return list; + } + + public boolean add(E object) { + if (list.isEmpty()) + { + list.add(object); + return true; + } + for(int i=0; i sortedProducerBeans) + { + if (sortedProducerBeans.isEmpty()) return; + AlternativesManager altManager = AlternativesManager.getInstance(); + Method superMethod = sortedProducerBeans.get(0).getCreatorMethod(); + + for(int i=1; i qualifiers = superBean.getQualifiers(); + for(Annotation an : qualifiers) + { + bean.addQualifier(an); + } + // inherit name is super class has name + boolean isSuperHasName = configuredProducerSpecializedName(bean, bean.getCreatorMethod(), superMethod); + + // disable super bean if needed + if (bean.getCreatorMethod().getAnnotation(Alternative.class) == null) + { + //disable superbean if the current bean is not an alternative + superBean.setEnabled(false); + } + else if(altManager.isClassAlternative(bean.getBeanClass())) + { + //disable superbean if the current bean is an enabled alternative + superBean.setEnabled(false); + } + + //if no name defined, set superMethod to this bean since this + //bean's method might have name defined. + if (!isSuperHasName) + { + superMethod = bean.getCreatorMethod(); + } + } + } + + /** + * Configure direct/indirect specialized producer method beans. + */ + public static void configureProducerMethodSpecializations() + { + Method method; + ProducerMethodBean pbean, pLeft, pRight; + + logger.debug("configure Specialized producer beans has started."); + + // collect all producer method beans + Set> beans = BeanManagerImpl.getManager().getBeans(); + List producerBeans = new ArrayList(); + for(Bean b : beans) + { + if (b instanceof ProducerMethodBean) + { + producerBeans.add((ProducerMethodBean)b); + } + } + + // create sorted bean helper. + SortedListHelper producerBeanListHelper = new + SortedListHelper(new ArrayList(), + new Comparator () + { + public int compare(ProducerMethodBean e1, ProducerMethodBean e2) + { + if (e1.getBeanClass().isAssignableFrom(e2.getBeanClass())) + { + return -1; + } + else if (e1.equals(e2)) + { + return 0; + } + return 1; + } + }); + + while(true) + { + pbean = null; + method = null; + producerBeanListHelper.clear(); + + //locate a specialized bean + for(ProducerMethodBean pb : producerBeans) + { + if (pb.isSpecializedBean()) + { + pbean = pb; + method = pb.getCreatorMethod(); + producerBeanListHelper.add(pb); + break; + } + } + if (pbean == null) break; + + pLeft = pRight = pbean; + boolean pLeftContinue = true; + boolean pRightContinue = true; + + // find all pbean's super beans and sub sub beans + while(pLeftContinue || pRightContinue) + { + pLeftContinue = pRightContinue = false; + for(ProducerMethodBean pb : producerBeans) + { + //left + if (pLeft!= null && + pLeft.getBeanClass().getSuperclass().equals(pb.getBeanClass())) + { + Method superMethod = ClassUtil.getClassMethodWithTypes(pb.getBeanClass(), method.getName(), Arrays.asList(method.getParameterTypes())); + if (superMethod != null) + { + producerBeanListHelper.add(pb); + pLeft = (pb.isSpecializedBean()) ? pb : null; + } + else { + pLeft = null; + } + if (pLeft != null) pLeftContinue = true; + } + //right + if (pRight != null && + pb.getBeanClass().getSuperclass().equals(pRight.getBeanClass())) + { + if (!pb.isSpecializedBean()) + { + pRight = null; + } else { + Method superMethod = ClassUtil.getClassMethodWithTypes(pb.getBeanClass(), method.getName(), Arrays.asList(method.getParameterTypes())); + if (superMethod != null) + { + producerBeanListHelper.add(pb); + pRight = pb; + } else + { + pRight = null; + } + } + if (pRight != null) pRightContinue = true; + } + } // for + } // while + + //remove the group from producer bean list + for(ProducerMethodBean pb : producerBeanListHelper.getList()) + { + producerBeans.remove(pb); + } + //configure the directly extended producer beans + configSpecializedProducerMethodBeans(producerBeanListHelper.getList()); + } + } + public static Set> isConfiguredWebBeans(Class clazz,boolean annotate) { @@ -1789,11 +1955,11 @@ for (Annotation ann : anns) { - component.addQualifier(ann); + component.addQualifier(ann); } - configuredProducerSpecializedName(component, method, superMethod); - + WebBeansUtil.configuredProducerSpecializedName(component, method, superMethod); + component.setSpecializedBean(true); } @@ -1805,7 +1971,7 @@ * @param method specialized producer method * @param superMethod overriden super producer method */ - public static void configuredProducerSpecializedName(AbstractOwbBean component,Method method,Method superMethod) + public static boolean configuredProducerSpecializedName(AbstractOwbBean component,Method method,Method superMethod) { Asserts.assertNotNull(component,"component parameter can not be null"); Asserts.assertNotNull(method,"method parameter can not be null"); @@ -1850,6 +2016,7 @@ component.setName(name); } + return hasName; // else // { // component.setName(name); Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java Wed Feb 24 07:33:40 2010 @@ -0,0 +1,38 @@ +/* + * 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.webbeans.newtests.specalization; + +import javax.enterprise.inject.Alternative; +import javax.enterprise.inject.New; +import javax.enterprise.inject.Produces; +import javax.enterprise.inject.Specializes; + +@Alternative +public class AdvancedPenProducer extends DefaultPenProducer { + + @Override + @Produces + @Alternative + @Specializes + @QualifierSpecialized IPen makeMeAPen(@New Pen pen) { + pen.str = "An advanced "; + return pen; + } + +} Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AdvancedPenProducer.java ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml Wed Feb 24 07:33:40 2010 @@ -0,0 +1,7 @@ + + + + org.apache.webbeans.newtests.specializes4.AdvancedPenProducer + org.apache.webbeans.newtests.specializes4.PremiumPenProducer + + Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java Wed Feb 24 07:33:40 2010 @@ -0,0 +1,73 @@ +/* + * 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.webbeans.newtests.specalization; + +import java.lang.annotation.Annotation; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Set; + +import javax.enterprise.context.spi.CreationalContext; +import javax.enterprise.inject.spi.Bean; +import javax.enterprise.util.AnnotationLiteral; + +import junit.framework.Assert; + +import org.apache.webbeans.newtests.AbstractUnitTest; +import org.junit.Test; + +public class AlternativeSpecializesProducerTest extends AbstractUnitTest { + + private static final String PACKAGE_NAME = AlternativeSpecializesProducerTest.class.getPackage().getName(); + + @Test + @SuppressWarnings("unchecked") + public void testAlternativeSpecializeBean() + { + + Collection beanXmls = new ArrayList(); + beanXmls.add(getXMLUrl(PACKAGE_NAME, "AlternativeSpecializesProducer")); + + Collection> beanClasses = new ArrayList>(); + beanClasses.add(Pen.class); + beanClasses.add(DefaultPenProducer.class); + beanClasses.add(AdvancedPenProducer.class); + beanClasses.add(PremiumPenProducer.class); + + startContainer(beanClasses, beanXmls); + + Annotation[] anns = new Annotation[1]; + anns[0] = new AnnotationLiteral() + { + }; + + + Set> beans = getBeanManager().getBeans(IPen.class, anns); + Assert.assertTrue(beans.size() == 1); + Bean bean = (Bean)beans.iterator().next(); + CreationalContext cc = getBeanManager().createCreationalContext(bean); + IPen pen = (IPen) getBeanManager().getReference(bean, IPen.class, cc); + Assert.assertTrue(pen.getID().contains("premium")); + + shutDownContainer(); + + } + +} Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducerTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java Wed Feb 24 07:33:40 2010 @@ -0,0 +1,32 @@ +/* + * 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.webbeans.newtests.specalization; + +import javax.enterprise.inject.New; +import javax.enterprise.inject.Produces; + +public class DefaultPenProducer { + + @Produces @QualifierSpecialized IPen makeMeAPen(@New Pen pen) { + pen.str = "An default "; + return pen; + } + + +} Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/DefaultPenProducer.java ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java Wed Feb 24 07:33:40 2010 @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.webbeans.newtests.specalization; + +public interface IPen { + + public String getID(); +} Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/IPen.java ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java Wed Feb 24 07:33:40 2010 @@ -0,0 +1,36 @@ +/* + * 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.webbeans.newtests.specalization; + +import javax.inject.Inject; + +public class Pen implements IPen { + + String str; + + @Inject + public Pen() { + this.str = ""; + } + + public String getID() { + return str + " Pen"; + } + +} Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/Pen.java ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java Wed Feb 24 07:33:40 2010 @@ -0,0 +1,38 @@ +/* + * 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.webbeans.newtests.specalization; + +import javax.enterprise.inject.Alternative; +import javax.enterprise.inject.New; +import javax.enterprise.inject.Produces; +import javax.enterprise.inject.Specializes; + +@Alternative +public class PremiumPenProducer extends AdvancedPenProducer { + + @Override + @Produces + @Alternative + @Specializes + @QualifierSpecialized IPen makeMeAPen(@New Pen pen) { + pen.str = "An premium "; + return pen; + } + +} Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/PremiumPenProducer.java ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java Wed Feb 24 07:33:40 2010 @@ -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.webbeans.newtests.specalization; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +@Qualifier +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.PARAMETER, ElementType.METHOD,ElementType.CONSTRUCTOR,ElementType.FIELD}) + +public @interface QualifierSpecialized { + +} Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/QualifierSpecialized.java ------------------------------------------------------------------------------ svn:eol-style = native Added: openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml?rev=915709&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml (added) +++ openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml Wed Feb 24 07:33:40 2010 @@ -0,0 +1,25 @@ + + + + + org.apache.webbeans.newtests.specalization.AdvancedPenProducer + org.apache.webbeans.newtests.specalization.PremiumPenProducer + + Propchange: openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml ------------------------------------------------------------------------------ svn:eol-style = native