Return-Path: Delivered-To: apmail-aries-commits-archive@www.apache.org Received: (qmail 67544 invoked from network); 27 Feb 2011 20:51:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Feb 2011 20:51:28 -0000 Received: (qmail 6681 invoked by uid 500); 27 Feb 2011 20:51:28 -0000 Delivered-To: apmail-aries-commits-archive@aries.apache.org Received: (qmail 6624 invoked by uid 500); 27 Feb 2011 20:51:28 -0000 Mailing-List: contact commits-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list commits@aries.apache.org Received: (qmail 6616 invoked by uid 99); 27 Feb 2011 20:51:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Feb 2011 20:51:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Sun, 27 Feb 2011 20:51:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B6A482388A93; Sun, 27 Feb 2011 20:50:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1075143 [5/23] - in /aries/tags/blueprint-0.2.1: ./ blueprint-annotation-api/ blueprint-annotation-api/src/ blueprint-annotation-api/src/main/ blueprint-annotation-api/src/main/java/ blueprint-annotation-api/src/main/java/org/ blueprint-an... Date: Sun, 27 Feb 2011 20:50:51 -0000 To: commits@aries.apache.org From: zoe@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110227205056.B6A482388A93@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TservicePropertyEntry.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TservicePropertyEntry.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TservicePropertyEntry.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TservicePropertyEntry.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,479 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.04.23 at 12:57:08 PM EDT +// + + +package org.apache.aries.blueprint.jaxb; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.NormalizedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + * + * TservicePropertyEntry is an entry value used for the + * element. This does not allow a child element and there are no + * key-ref or value-ref attributes. + * + * + * + *

Java class for TservicePropertyEntry complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="TservicePropertyEntry">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <group ref="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Gvalue" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="key" use="required" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}TstringValue" />
+ *       <attribute name="value" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}TstringValue" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TservicePropertyEntry", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", propOrder = { + "service", + "referenceList", + "bean", + "reference", + "ref", + "any", + "idref", + "value", + "list", + "set", + "map", + "array", + "props", + "_null" +}) +@XmlRootElement(name = "servicePropertyEntry") +public class TservicePropertyEntry { + + protected TinlinedService service; + @XmlElement(name = "reference-list") + protected TinlinedReferenceList referenceList; + protected TinlinedBean bean; + protected TinlinedReference reference; + protected Tref ref; + @XmlAnyElement(lax = true) + protected Object any; + protected Tref idref; + protected Tvalue value; + protected Tcollection list; + protected Tcollection set; + protected Tmap map; + protected Tcollection array; + protected Tprops props; + @XmlElement(name = "null") + protected Tnull _null; + @XmlAttribute(required = true) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String key; + @XmlAttribute(name = "value") + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + protected String valueAttribute; + + /** + * Gets the value of the service property. + * + * @return + * possible object is + * {@link TinlinedService } + * + */ + public TinlinedService getService() { + return service; + } + + /** + * Sets the value of the service property. + * + * @param value + * allowed object is + * {@link TinlinedService } + * + */ + public void setService(TinlinedService value) { + this.service = value; + } + + /** + * Gets the value of the referenceList property. + * + * @return + * possible object is + * {@link TinlinedReferenceList } + * + */ + public TinlinedReferenceList getReferenceList() { + return referenceList; + } + + /** + * Sets the value of the referenceList property. + * + * @param value + * allowed object is + * {@link TinlinedReferenceList } + * + */ + public void setReferenceList(TinlinedReferenceList value) { + this.referenceList = value; + } + + /** + * Gets the value of the bean property. + * + * @return + * possible object is + * {@link TinlinedBean } + * + */ + public TinlinedBean getBean() { + return bean; + } + + /** + * Sets the value of the bean property. + * + * @param value + * allowed object is + * {@link TinlinedBean } + * + */ + public void setBean(TinlinedBean value) { + this.bean = value; + } + + /** + * Gets the value of the reference property. + * + * @return + * possible object is + * {@link TinlinedReference } + * + */ + public TinlinedReference getReference() { + return reference; + } + + /** + * Sets the value of the reference property. + * + * @param value + * allowed object is + * {@link TinlinedReference } + * + */ + public void setReference(TinlinedReference value) { + this.reference = value; + } + + /** + * Gets the value of the ref property. + * + * @return + * possible object is + * {@link Tref } + * + */ + public Tref getRef() { + return ref; + } + + /** + * Sets the value of the ref property. + * + * @param value + * allowed object is + * {@link Tref } + * + */ + public void setRef(Tref value) { + this.ref = value; + } + + /** + * Gets the value of the any property. + * + * @return + * possible object is + * {@link Object } + * + */ + public Object getAny() { + return any; + } + + /** + * Sets the value of the any property. + * + * @param value + * allowed object is + * {@link Object } + * + */ + public void setAny(Object value) { + this.any = value; + } + + /** + * Gets the value of the idref property. + * + * @return + * possible object is + * {@link Tref } + * + */ + public Tref getIdref() { + return idref; + } + + /** + * Sets the value of the idref property. + * + * @param value + * allowed object is + * {@link Tref } + * + */ + public void setIdref(Tref value) { + this.idref = value; + } + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link Tvalue } + * + */ + public Tvalue getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link Tvalue } + * + */ + public void setValue(Tvalue value) { + this.value = value; + } + + /** + * Gets the value of the list property. + * + * @return + * possible object is + * {@link Tcollection } + * + */ + public Tcollection getList() { + return list; + } + + /** + * Sets the value of the list property. + * + * @param value + * allowed object is + * {@link Tcollection } + * + */ + public void setList(Tcollection value) { + this.list = value; + } + + /** + * Gets the value of the set property. + * + * @return + * possible object is + * {@link Tcollection } + * + */ + public Tcollection getSet() { + return set; + } + + /** + * Sets the value of the set property. + * + * @param value + * allowed object is + * {@link Tcollection } + * + */ + public void setSet(Tcollection value) { + this.set = value; + } + + /** + * Gets the value of the map property. + * + * @return + * possible object is + * {@link Tmap } + * + */ + public Tmap getMap() { + return map; + } + + /** + * Sets the value of the map property. + * + * @param value + * allowed object is + * {@link Tmap } + * + */ + public void setMap(Tmap value) { + this.map = value; + } + + /** + * Gets the value of the array property. + * + * @return + * possible object is + * {@link Tcollection } + * + */ + public Tcollection getArray() { + return array; + } + + /** + * Sets the value of the array property. + * + * @param value + * allowed object is + * {@link Tcollection } + * + */ + public void setArray(Tcollection value) { + this.array = value; + } + + /** + * Gets the value of the props property. + * + * @return + * possible object is + * {@link Tprops } + * + */ + public Tprops getProps() { + return props; + } + + /** + * Sets the value of the props property. + * + * @param value + * allowed object is + * {@link Tprops } + * + */ + public void setProps(Tprops value) { + this.props = value; + } + + /** + * Gets the value of the null property. + * + * @return + * possible object is + * {@link Tnull } + * + */ + public Tnull getNull() { + return _null; + } + + /** + * Sets the value of the null property. + * + * @param value + * allowed object is + * {@link Tnull } + * + */ + public void setNull(Tnull value) { + this._null = value; + } + + /** + * Gets the value of the key property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getKey() { + return key; + } + + /** + * Sets the value of the key property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setKey(String value) { + this.key = value; + } + + /** + * Gets the value of the valueAttribute property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValueAttribute() { + return valueAttribute; + } + + /** + * Sets the value of the valueAttribute property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValueAttribute(String value) { + this.valueAttribute = value; + } + +} Added: aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TserviceReference.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TserviceReference.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TserviceReference.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TserviceReference.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,237 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.04.23 at 12:57:08 PM EDT +// + + +package org.apache.aries.blueprint.jaxb; + +import java.util.List; +import java.util.Vector; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.NormalizedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + * + * TserviceReference is the base element type used for + * and elements. This type defines all of the + * characteristics common to both sorts of references. + * + * + * + *

Java class for TserviceReference complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="TserviceReference">
+ *   <complexContent>
+ *     <extension base="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tcomponent">
+ *       <sequence>
+ *         <group ref="{http://www.osgi.org/xmlns/blueprint/v1.0.0}GserviceReferenceElements"/>
+ *       </sequence>
+ *       <attribute name="interface" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tclass" />
+ *       <attribute name="filter" type="{http://www.w3.org/2001/XMLSchema}normalizedString" />
+ *       <attribute name="component-name" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tidref" />
+ *       <attribute name="availability" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tavailability" />
+ *     </extension>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TserviceReference", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", propOrder = { + "description", + "referenceListener" +}) +@XmlSeeAlso({ + TreferenceList.class, + Treference.class +}) +@XmlRootElement(name = "serviceReference") +public class TserviceReference + extends Tcomponent +{ + + protected Tdescription description; + @XmlElement(name = "reference-listener") + protected List referenceListener = new Vector(); + @XmlAttribute(name = "interface") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String _interface; + @XmlAttribute + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + @XmlSchemaType(name = "normalizedString") + protected String filter; + @XmlAttribute(name = "component-name") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String componentName; + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String availability; + + /** + * Gets the value of the description property. + * + * @return + * possible object is + * {@link Tdescription } + * + */ + public Tdescription getDescription() { + return description; + } + + /** + * Sets the value of the description property. + * + * @param value + * allowed object is + * {@link Tdescription } + * + */ + public void setDescription(Tdescription value) { + this.description = value; + } + + /** + * Gets the value of the referenceListener property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the referenceListener property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReferenceListener().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link TreferenceListener } + * + * + */ + public List getReferenceListener() { + if (referenceListener == null) { + referenceListener = new Vector(); + } + return this.referenceListener; + } + + /** + * Gets the value of the interface property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInterface() { + return _interface; + } + + /** + * Sets the value of the interface property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInterface(String value) { + this._interface = value; + } + + /** + * Gets the value of the filter property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFilter() { + return filter; + } + + /** + * Sets the value of the filter property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFilter(String value) { + this.filter = value; + } + + /** + * Gets the value of the componentName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getComponentName() { + return componentName; + } + + /** + * Sets the value of the componentName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setComponentName(String value) { + this.componentName = value; + } + + /** + * Gets the value of the availability property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAvailability() { + return availability; + } + + /** + * Sets the value of the availability property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAvailability(String value) { + this.availability = value; + } + +} Added: aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypeConverters.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypeConverters.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypeConverters.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypeConverters.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,100 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.04.23 at 12:57:08 PM EDT +// + + +package org.apache.aries.blueprint.jaxb; + +import java.util.List; +import java.util.Vector; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElementRefs; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * + * + * The type used for the element. The + * section is a set of , , or + * elements that identify the type converter components. + * + * + * + *

Java class for Ttype-converters complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Ttype-converters">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <choice maxOccurs="unbounded" minOccurs="0">
+ *         <element name="bean" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tbean"/>
+ *         <element name="reference" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Treference"/>
+ *         <element name="ref" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tref"/>
+ *         <any/>
+ *       </choice>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Ttype-converters", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", propOrder = { + "beanOrReferenceOrRef" +}) +@XmlRootElement(name = "typeConverters") +public class TtypeConverters { + + @XmlElementRefs({ + @XmlElementRef(name = "ref", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", type = JAXBElement.class), + @XmlElementRef(name = "bean", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", type = JAXBElement.class), + @XmlElementRef(name = "reference", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", type = JAXBElement.class) + }) + @XmlAnyElement(lax = true) + protected List beanOrReferenceOrRef = new Vector(); + + /** + * Gets the value of the beanOrReferenceOrRef property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the beanOrReferenceOrRef property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getBeanOrReferenceOrRef().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link JAXBElement }{@code <}{@link Tref }{@code >} + * {@link JAXBElement }{@code <}{@link Tbean }{@code >} + * {@link JAXBElement }{@code <}{@link Treference }{@code >} + * + * + */ + public List getBeanOrReferenceOrRef() { + if (beanOrReferenceOrRef == null) { + beanOrReferenceOrRef = new Vector(); + } + return this.beanOrReferenceOrRef; + } + +} Added: aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypedCollection.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypedCollection.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypedCollection.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/TtypedCollection.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,82 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.04.23 at 12:57:08 PM EDT +// + + +package org.apache.aries.blueprint.jaxb; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + * + * TtypeCollection defines comment attributes shared among different + * collection types that allow a default value type to be specified. + * + * + * + *

Java class for TtypedCollection complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="TtypedCollection">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <attribute name="value-type" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Ttype" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TtypedCollection", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0") +@XmlSeeAlso({ + Tmap.class, + Tcollection.class +}) +@XmlRootElement(name = "typedCollection") +public class TtypedCollection { + + @XmlAttribute(name = "value-type") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String valueType; + + /** + * Gets the value of the valueType property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValueType() { + return valueType; + } + + /** + * Sets the value of the valueType property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValueType(String value) { + this.valueType = value; + } + +} Added: aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tvalue.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tvalue.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tvalue.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/Tvalue.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,125 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.04.23 at 12:57:08 PM EDT +// + + +package org.apache.aries.blueprint.jaxb; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * + * + * Tvalue is the type used for elements. The element + * is used for types that can be created from a single string value. + * The string value is the data value for the element. The optional + * type attribute allows a target conversion value to be explicitly + * specified. + * + * + * + *

Java class for Tvalue complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="Tvalue">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <attribute name="type" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Ttype" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "Tvalue", namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", propOrder = { + "content" +}) +@XmlRootElement(name = "value") +public class Tvalue { + + @XmlValue + protected String content; + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String type; + + /** + * + * + * Tvalue is the type used for elements. The element + * is used for types that can be created from a single string value. + * The string value is the data value for the element. The optional + * type attribute allows a target conversion value to be explicitly + * specified. + * + * + * + * @return + * possible object is + * {@link String } + * + */ + public String getContent() { + return content; + } + + /** + * + * + * Tvalue is the type used for elements. The element + * is used for types that can be created from a single string value. + * The string value is the data value for the element. The optional + * type attribute allows a target conversion value to be explicitly + * specified. + * + * + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContent(String value) { + this.content = value; + } + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + +} Added: aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/package-info.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/package-info.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/package-info.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/package-info.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,9 @@ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2010.04.23 at 12:57:08 PM EDT +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.osgi.org/xmlns/blueprint/v1.0.0", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.apache.aries.blueprint.jaxb; Added: aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/test/java/org/apache/aries/blueprint/annotation/AnnotationTest.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/test/java/org/apache/aries/blueprint/annotation/AnnotationTest.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/test/java/org/apache/aries/blueprint/annotation/AnnotationTest.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-impl/src/test/java/org/apache/aries/blueprint/annotation/AnnotationTest.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,74 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.aries.blueprint.annotation; + +import java.io.File; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; + +import org.apache.aries.blueprint.jaxb.Tbean; +import org.apache.aries.blueprint.jaxb.Tblueprint; +import org.apache.aries.blueprint.jaxb.Tproperty; +import org.apache.aries.blueprint.jaxb.Tvalue; +import org.osgi.framework.Bundle; +import org.osgi.framework.Version; + +import junit.framework.TestCase; + +public class AnnotationTest extends TestCase { + + public void testGenerationFile() throws Exception { + File file = new File("test-annotation.xml"); + if (file.exists()) { + file.delete(); + file.createNewFile(); + } + + Tblueprint tblueprint = new Tblueprint(); + List components = tblueprint.getServiceOrReferenceListOrBean(); + Tbean tbean = new Tbean(); + tbean.setDependsOn(null); + tbean.setId("Bar"); + tbean.setClazz("org.apache.aries.blueprint.sample.Bar"); + List props = tbean.getArgumentOrPropertyOrAny(); + + String value = "Hello Bar"; + Tproperty tp = new Tproperty(); + tp.setName("value"); + //Tvalue tvalue = new Tvalue(); + //tvalue.setContent(value); + //tp.setValue(tvalue); + tp.setValueAttribute(value); + props.add(tp); + + components.add(tbean); + + marshallOBRModel(tblueprint, file); + } + + private void marshallOBRModel(Tblueprint tblueprint, File blueprintFile) + throws JAXBException { + JAXBContext context = JAXBContext.newInstance(Tblueprint.class); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + marshaller.marshal(tblueprint, blueprintFile); + + } +} Added: aries/tags/blueprint-0.2.1/blueprint-annotation-itest/pom.xml URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-itest/pom.xml?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-itest/pom.xml (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-itest/pom.xml Sun Feb 27 20:50:38 2011 @@ -0,0 +1,216 @@ + + + 4.0.0 + + org.apache.aries.blueprint + blueprint + 0.2.1 + + + org.apache.aries.blueprint.annotation.itests + Apache Aries Blueprint Annotation iTests + + Integration tests using the standalone blueprint-bundle for the implementation + and blueprint-sample-annotation for the blueprint application to be tested. + + + + + org.osgi + org.osgi.core + provided + + + org.osgi + org.osgi.compendium + provided + + + org.eclipse + osgi + provided + + + org.apache.aries.blueprint + org.apache.aries.blueprint + test + + + org.apache.aries + org.apache.aries.util + test + + + org.apache.aries.blueprint + org.apache.aries.blueprint.sample + test + + + org.apache.aries.blueprint + org.apache.aries.blueprint.sample-annotation + ${version} + test + + + org.apache.aries.blueprint + org.apache.aries.blueprint.testbundlea + test + + + org.apache.aries.blueprint + org.apache.aries.blueprint.testbundleb + test + + + org.ops4j.pax.exam + pax-exam + test + + + org.ops4j.pax.exam + pax-exam-junit + test + + + org.ops4j.pax.exam + pax-exam-container-default + test + + + org.ops4j.pax.exam + pax-exam-junit-extender-impl + test + + + org.ops4j.pax.runner + pax-runner-no-jcl + + + junit + junit + test + + + org.apache.felix + org.apache.felix.configadmin + test + + + org.ops4j.pax.logging + pax-logging-api + test + + + org.ops4j.pax.logging + pax-logging-service + test + + + org.ops4j.pax.url + pax-url-mvn + test + + + org.apache.servicemix.bundles + org.apache.servicemix.bundles.cglib + test + + + asm + asm-all + test + + + org.apache.xbean + xbean-finder + test + + + org.apache.aries.blueprint + org.apache.aries.blueprint.annotation.api + + + org.apache.aries.blueprint + org.apache.aries.blueprint.annotation.impl + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + pertest + + **/*$* + **/Abstract*.java + + + **/Test*.java + **/*Test.java + + + + + org.ops4j.pax.exam + maven-paxexam-plugin + + + generate-config + + generate-depends-file + + + ${project.build.directory}/test-classes/META-INF/maven/dependencies.properties + + + + + + + + + + ci-build-profile + + + maven.repo.local + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + -Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local} + + + + + + + + Added: aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/AbstractIntegrationTest.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,278 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.aries.blueprint.itests; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.*; +import java.net.URISyntaxException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Currency; +import java.util.List; +import java.util.Properties; + +import org.apache.aries.blueprint.sample.Bar; +import org.apache.aries.blueprint.sample.Foo; +import org.junit.After; +import org.junit.Before; +import org.ops4j.pax.exam.CoreOptions; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.wrappedBundle; +import org.ops4j.pax.exam.Inject; +import org.ops4j.pax.exam.Option; +import static org.ops4j.pax.exam.OptionUtils.combine; +import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.Filter; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.service.blueprint.container.BlueprintContainer; +import org.osgi.util.tracker.ServiceTracker; + +public abstract class AbstractIntegrationTest { + + public static final long DEFAULT_TIMEOUT = 30000; + + private List srs; + + @Before + public void setUp() { + srs = new ArrayList(); + } + + @After + public void tearDown() throws Exception{ + for (ServiceTracker st : srs) { + if (st != null) { + st.close(); + } + } + } + + @Inject + protected BundleContext bundleContext; + + protected BlueprintContainer getBlueprintContainerForBundle(String symbolicName) throws Exception { + return getBlueprintContainerForBundle(symbolicName, DEFAULT_TIMEOUT); + } + + protected BlueprintContainer getBlueprintContainerForBundle(String symbolicName, long timeout) throws Exception { + return getOsgiService(BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=" + symbolicName + ")", timeout); + } + + protected BlueprintContainer getBlueprintContainerForBundle(BundleContext bc, String symbolicName, long timeout) throws Exception { + return getOsgiService(bc, BlueprintContainer.class, "(osgi.blueprint.container.symbolicname=" + symbolicName + ")", timeout); + } + + protected T getOsgiService(Class type, long timeout) { + return getOsgiService(type, null, timeout); + } + + protected T getOsgiService(Class type) { + return getOsgiService(type, null, DEFAULT_TIMEOUT); + } + + protected T getOsgiService(BundleContext bc, Class type, String filter, long timeout) { + ServiceTracker tracker = null; + try { + String flt; + if (filter != null) { + if (filter.startsWith("(")) { + flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")" + filter + ")"; + } else { + flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")(" + filter + "))"; + } + } else { + flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"; + } + Filter osgiFilter = FrameworkUtil.createFilter(flt); + tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter, null); + tracker.open(); + + // add tracker to the list of trackers we close at tear down + srs.add(tracker); + Object svc = type.cast(tracker.waitForService(timeout)); + if (svc == null) { + throw new RuntimeException("Gave up waiting for service " + flt); + } + return type.cast(svc); + } catch (InvalidSyntaxException e) { + throw new IllegalArgumentException("Invalid filter", e); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + protected T getOsgiService(Class type, String filter, long timeout) { + return getOsgiService(null, type, filter, timeout); + } + + protected Bundle installBundle(String groupId, String artifactId) throws Exception { + MavenArtifactProvisionOption mvnUrl = mavenBundle(groupId, artifactId); + return bundleContext.installBundle(mvnUrl.getURL()); + } + + protected Bundle getInstalledBundle(String symbolicName) { + for (Bundle b : bundleContext.getBundles()) { + if (b.getSymbolicName().equals(symbolicName)) { + return b; + } + } + return null; + } + + public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId) { + return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject(); + } + + public static MavenArtifactProvisionOption mavenBundleInTest(String groupId, String artifactId) { + return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).version(getArtifactVersion(groupId, artifactId)); + } + + //TODO getArtifactVersion and getFileFromClasspath are borrowed and modified from pax-exam. They should be moved back ASAP. + public static String getArtifactVersion( final String groupId, + final String artifactId ) + { + final Properties dependencies = new Properties(); + try + { + InputStream in = getFileFromClasspath("META-INF/maven/dependencies.properties"); + try { + dependencies.load(in); + } finally { + in.close(); + } + final String version = dependencies.getProperty( groupId + "/" + artifactId + "/version" ); + if( version == null ) + { + throw new RuntimeException( + "Could not resolve version. Do you have a dependency for " + groupId + "/" + artifactId + + " in your maven project?" + ); + } + return version; + } + catch( IOException e ) + { + // TODO throw a better exception + throw new RuntimeException( + "Could not resolve version. Did you configured the plugin in your maven project?" + + "Or maybe you did not run the maven build and you are using an IDE?" + ); + } + } + + private static InputStream getFileFromClasspath( final String filePath ) + throws FileNotFoundException + { + try + { + URL fileURL = AbstractIntegrationTest.class.getClassLoader().getResource( filePath ); + if( fileURL == null ) + { + throw new FileNotFoundException( "File [" + filePath + "] could not be found in classpath" ); + } + return fileURL.openStream(); + } + catch (IOException e) + { + throw new FileNotFoundException( "File [" + filePath + "] could not be found: " + e.getMessage() ); + } + } + + + protected static Option[] updateOptions(Option[] options) { + // We need to add pax-exam-junit here when running with the ibm + // jdk to avoid the following exception during the test run: + // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration + if ("IBM Corporation".equals(System.getProperty("java.vendor"))) { + Option[] ibmOptions = options( + wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit")) + ); + options = combine(ibmOptions, options); + } + + return options; + } + + protected void testBlueprintContainer(Bundle bundle) throws Exception { + testBlueprintContainer(bundleContext, bundle); + } + + + protected void testBlueprintContainer(BundleContext bc, Bundle bundle) throws Exception { + BlueprintContainer blueprintContainer = getBlueprintContainerForBundle( + bc == null ? bundleContext : bc, "org.apache.aries.blueprint.sample", + 5000); + assertNotNull(blueprintContainer); + + Object obj = blueprintContainer.getComponentInstance("bar"); + assertNotNull(obj); + assertEquals(Bar.class, obj.getClass()); + Bar bar = (Bar) obj; + assertNotNull(bar.getContext()); + assertEquals("Hello FooBar", bar.getValue()); + assertNotNull(bar.getList()); + assertEquals(2, bar.getList().size()); + assertEquals("a list element", bar.getList().get(0)); + assertEquals(Integer.valueOf(5), bar.getList().get(1)); + obj = blueprintContainer.getComponentInstance("foo"); + assertNotNull(obj); + assertEquals(Foo.class, obj.getClass()); + Foo foo = (Foo) obj; + assertEquals(5, foo.getA()); + assertEquals(10, foo.getB()); + assertSame(bar, foo.getBar()); + assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); + assertEquals(new SimpleDateFormat("yyyy.MM.dd").parse("2009.04.17"), + foo.getDate()); + + assertTrue(foo.isInitialized()); + assertFalse(foo.isDestroyed()); + + obj = getOsgiService(bc == null ? bundleContext : bc, Foo.class, null, 5000); + assertNotNull(obj); + assertSame(foo, obj); + + bundle.stop(); + + Thread.sleep(1000); + + try { + blueprintContainer = getBlueprintContainerForBundle(bc == null ? bundleContext : bc, + "org.apache.aries.blueprint.sample", 1); + fail("BlueprintContainer should have been unregistered"); + } catch (Exception e) { + // Expected, as the module container should have been unregistered + } + + assertTrue(foo.isInitialized()); + assertTrue(foo.isDestroyed()); + } + +} Added: aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/BlueprintAnnotationTest.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/BlueprintAnnotationTest.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/BlueprintAnnotationTest.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-annotation-itest/src/test/java/org/apache/aries/blueprint/itests/BlueprintAnnotationTest.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,116 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.aries.blueprint.itests; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.ops4j.pax.exam.CoreOptions.equinox; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + +import java.text.SimpleDateFormat; +import java.util.Currency; +import java.util.Hashtable; +import java.util.Set; + +import org.apache.aries.blueprint.sample.Bar; +import org.apache.aries.blueprint.sample.Foo; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.JUnit4TestRunner; +import org.osgi.framework.Bundle; +import org.osgi.service.blueprint.container.BlueprintContainer; +import org.osgi.service.cm.Configuration; +import org.osgi.service.cm.ConfigurationAdmin; + +@RunWith(JUnit4TestRunner.class) +public class BlueprintAnnotationTest extends AbstractIntegrationTest { + + @Test + public void test() throws Exception { + BlueprintContainer blueprintContainer = getBlueprintContainerForBundle( + bundleContext, "org.apache.aries.blueprint.sample-annotation", + 5000); + + assertNotNull(blueprintContainer); + + Object obj = blueprintContainer.getComponentInstance("bar"); + assertNotNull(obj); + assertEquals(Bar.class, obj.getClass()); + Bar bar = (Bar) obj; + assertEquals("Hello FooBar", bar.getValue()); + + obj = blueprintContainer.getComponentInstance("foo"); + assertNotNull(obj); + assertEquals(Foo.class, obj.getClass()); + Foo foo = (Foo) obj; + assertEquals(5, foo.getA()); + // assertEquals(10, foo.getB()); + assertSame(bar, foo.getBar()); + assertEquals(Currency.getInstance("PLN"), foo.getCurrency()); + assertEquals(new SimpleDateFormat("yyyy.MM.dd").parse("2009.04.17"), + foo.getDate()); + + assertTrue(foo.isInitialized()); + assertFalse(foo.isDestroyed()); + + obj = getOsgiService(bundleContext, Foo.class, null, 5000); + assertNotNull(obj); + assertSame(foo, obj); + } + + @org.ops4j.pax.exam.junit.Configuration + public static Option[] configuration() { + Option[] options = options( + // Log + mavenBundle("org.ops4j.pax.logging", "pax-logging-api"), + mavenBundle("org.ops4j.pax.logging", "pax-logging-service"), + // Felix Config Admin + mavenBundle("org.apache.felix", "org.apache.felix.configadmin"), + // Felix mvn url handler + mavenBundle("org.ops4j.pax.url", "pax-url-mvn"), + + + // this is how you set the default log level when using pax logging (logProfile) + systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"), + + // Bundles + mavenBundle("org.apache.aries", "org.apache.aries.util"), + mavenBundle("asm", "asm-all"), + mavenBundle("org.apache.xbean", "xbean-finder"), + mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.annotation.api"), + mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"), + mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.annotation.impl"), + mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample-annotation"), + //mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.sample"), + mavenBundle("org.osgi", "org.osgi.compendium"), + //org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"), + + equinox().version("3.5.0") + ); + options = updateOptions(options); + return options; + } + +} Added: aries/tags/blueprint-0.2.1/blueprint-api/pom.xml URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-api/pom.xml?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-api/pom.xml (added) +++ aries/tags/blueprint-0.2.1/blueprint-api/pom.xml Sun Feb 27 20:50:38 2011 @@ -0,0 +1,49 @@ + + + 4.0.0 + + org.apache.aries.blueprint + blueprint + 0.2.1 + + + org.apache.aries.blueprint.api + bundle + Apache Aries Blueprint API + + This bundle contains the blueprint api 1.0.1 and the corresponding xml schema. + + + + + org.osgi.service.blueprint*;version="1.0.1" + + + !org.osgi.service.blueprint*, + * + + + + + + org.eclipse + osgi + provided + + + Added: aries/tags/blueprint-0.2.1/blueprint-api/src/main/appended-resources/META-INF/NOTICE.vm URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-api/src/main/appended-resources/META-INF/NOTICE.vm?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-api/src/main/appended-resources/META-INF/NOTICE.vm (added) +++ aries/tags/blueprint-0.2.1/blueprint-api/src/main/appended-resources/META-INF/NOTICE.vm Sun Feb 27 20:50:38 2011 @@ -0,0 +1,2 @@ +This product includes software developed at +the OSGi Alliance (http://www.osgi.org/). \ No newline at end of file Added: aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintContainer.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,100 @@ +/* + * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved. + * + * Licensed 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.osgi.service.blueprint.container; + +import java.util.Collection; +import java.util.Set; + +import org.osgi.service.blueprint.reflect.BeanMetadata; +import org.osgi.service.blueprint.reflect.ComponentMetadata; +import org.osgi.service.blueprint.reflect.ReferenceListMetadata; +import org.osgi.service.blueprint.reflect.ReferenceMetadata; +import org.osgi.service.blueprint.reflect.ServiceMetadata; +import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata; + +/** + * A Blueprint Container represents the managed state of a Blueprint bundle. + * + * A Blueprint Container provides access to all managed components. These are + * the beans, services, and service references. Only bundles in the + * ACTIVE state (and also the STARTING state for + * bundles awaiting lazy activation) can have an associated Blueprint Container. + * A given Bundle Context has at most one associated Blueprint Container. + * + * A Blueprint Container can be obtained by injecting the predefined + * "blueprintContainer" component id. The Blueprint Container is also + * registered as a service and its managed components can be queried. + * + * @ThreadSafe + * @version $Revision: 791585 $ + */ +public interface BlueprintContainer { + /** + * Returns the set of component ids managed by this Blueprint Container. + * + * @return An immutable Set of Strings, containing the ids of all of the + * components managed within this Blueprint Container. + */ + Set getComponentIds(); + + /** + * Return the component instance for the specified component id. + * + * If the component's manager has not yet been activated, calling this + * operation will atomically activate it. If the component has singleton + * scope, the activation will cause the component instance to be created and + * initialized. If the component has prototype scope, then each call to this + * method will return a new component instance. + * + * @param id The component id for the requested component instance. + * @return A component instance for the component with the specified + * component id. + * @throws NoSuchComponentException If no component with the specified + * component id is managed by this Blueprint Container. + */ + Object getComponentInstance(String id); + + /** + * Return the Component Metadata object for the component with the specified + * component id. + * + * @param id The component id for the requested Component Metadata. + * @return The Component Metadata object for the component with the + * specified component id. + * @throws NoSuchComponentException If no component with the specified + * component id is managed by this Blueprint Container. + */ + ComponentMetadata getComponentMetadata(String id); + + /** + * Return all {@link ComponentMetadata} objects of the specified Component + * Metadata type. The supported Component Metadata types are + * {@link ComponentMetadata} (which returns the Component Metadata for all + * defined manager types), {@link BeanMetadata} , + * {@link ServiceReferenceMetadata} (which returns both + * {@link ReferenceMetadata} and {@link ReferenceListMetadata} objects), and + * {@link ServiceMetadata}. The collection will include all Component + * Metadata objects of the requested type, including components that are + * declared inline. + * + * @param type The super type or type of the requested Component Metadata + * objects. + * @return An immutable collection of Component Metadata objects of the + * specified type. + */ + Collection getMetadata( + Class type); +} Added: aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,370 @@ +/* + * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved. + * + * Licensed 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.osgi.service.blueprint.container; + +import org.osgi.framework.Bundle; + +/** + * A Blueprint Event. + * + *

+ * BlueprintEvent objects are delivered to all registered + * {@link BlueprintListener} services. Blueprint Events must be asynchronously + * delivered in chronological order with respect to each listener. + * + *

+ * In addition, after a Blueprint Listener is registered, the Blueprint extender + * will synchronously send to this Blueprint Listener the last Blueprint Event + * for each ready Blueprint bundle managed by this extender. This + * replay of Blueprint Events is designed so that the new Blueprint + * Listener can be informed of the state of each Blueprint bundle. Blueprint + * Events sent during this replay will have the {@link #isReplay()} flag set. + * The Blueprint extender must ensure that this replay phase does not interfere + * with new Blueprint Events so that the chronological order of all Blueprint + * Events received by the Blueprint Listener is preserved. If the last Blueprint + * Event for a given Blueprint bundle is {@link #DESTROYED}, the extender must + * not send it during this replay phase. + * + *

+ * A type code is used to identify the type of event. The following event types + * are defined: + *

    + *
  • {@link #CREATING}
  • + *
  • {@link #CREATED}
  • + *
  • {@link #DESTROYING}
  • + *
  • {@link #DESTROYED}
  • + *
  • {@link #FAILURE}
  • + *
  • {@link #GRACE_PERIOD}
  • + *
  • {@link #WAITING}
  • + *
+ * + *

+ * In addition to calling the registered {@link BlueprintListener} services, the + * Blueprint extender must also send those events to the Event Admin service, if + * it is available. + * + * @see BlueprintListener + * @see EventConstants + * @Immutable + * @version $Revision: 1071714 $ + */ +public class BlueprintEvent { + + /** + * The Blueprint extender has started creating a Blueprint Container for the + * bundle. + */ + public static final int CREATING = 1; + /** + * The Blueprint extender has created a Blueprint Container for the bundle. + * This event is sent after the Blueprint Container has been registered as a + * service. + */ + public static final int CREATED = 2; + /** + * The Blueprint extender has started destroying the Blueprint Container for + * the bundle. + */ + public static final int DESTROYING = 3; + /** + * The Blueprint Container for the bundle has been completely destroyed. + * This event is sent after the Blueprint Container has been unregistered as + * a service. + */ + public static final int DESTROYED = 4; + /** + * The Blueprint Container creation for the bundle has failed. If this event + * is sent after a timeout in the Grace Period, the + * {@link #getDependencies()} method must return an array of missing + * mandatory dependencies. The event must also contain the cause of the + * failure as a Throwable through the {@link #getCause()} + * method. + */ + public static final int FAILURE = 5; + /** + * The Blueprint Container has entered the grace period. The list of missing + * dependencies must be made available through the + * {@link #getDependencies()} method. During the grace period, a + * {@link #GRACE_PERIOD} event is sent each time the set of unsatisfied + * dependencies changes. + */ + public static final int GRACE_PERIOD = 6; + /** + * The Blueprint Container is waiting on the availability of a service to + * satisfy an invocation on a referenced service. The missing dependency + * must be made available through the {@link #getDependencies()} method + * which will return an array containing one filter object as a String. + */ + public static final int WAITING = 7; + + /** + * Type of this event. + * + * @see #getType() + */ + private final int type; + /** + * The time when the event occurred. + * + * @see #getTimestamp() + */ + private final long timestamp; + /** + * The Blueprint bundle. + * + * @see #getBundle() + */ + private final Bundle bundle; + /** + * The Blueprint extender bundle. + * + * @see #getExtenderBundle() + */ + private final Bundle extenderBundle; + /** + * An array containing filters identifying the missing dependencies. Must + * not be null when the event type requires it. + * + * @see #getDependencies() + */ + private final String[] dependencies; + /** + * Cause of the failure. + * + * @see #getCause() + */ + private final Throwable cause; + /** + * Indicate if this event is a replay event or not. + * + * @see #isReplay() + */ + private final boolean replay; + + /** + * Create a simple BlueprintEvent object. + * + * @param type The type of this event. + * @param bundle The Blueprint bundle associated with this event. This + * parameter must not be null. + * @param extenderBundle The Blueprint extender bundle that is generating + * this event. This parameter must not be null. + */ + public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle) { + this(type, bundle, extenderBundle, null, null); + } + + /** + * Create a BlueprintEvent object associated with a set of + * dependencies. + * + * @param type The type of this event. + * @param bundle The Blueprint bundle associated with this event. This + * parameter must not be null. + * @param extenderBundle The Blueprint extender bundle that is generating + * this event. This parameter must not be null. + * @param dependencies An array of String filters for each + * dependency associated with this event. Must be a non-empty array + * for event types {@link #FAILURE}, {@link #GRACE_PERIOD} and + * {@link #WAITING}. Must be null for other event types. + */ + public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, + String[] dependencies) { + this(type, bundle, extenderBundle, dependencies, null); + } + + /** + * Create a BlueprintEvent object associated with a failure + * cause. + * + * @param type The type of this event. + * @param bundle The Blueprint bundle associated with this event. This + * parameter must not be null. + * @param extenderBundle The Blueprint extender bundle that is generating + * this event. This parameter must not be null. + * @param cause A Throwable object describing the root cause of + * the event. May be null. + */ + public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, + Throwable cause) { + this(type, bundle, extenderBundle, null, cause); + } + + /** + * Create a BlueprintEvent object associated with a failure + * cause and a set of dependencies. + * + * @param type The type of this event. + * @param bundle The Blueprint bundle associated with this event. This + * parameter must not be null. + * @param extenderBundle The Blueprint extender bundle that is generating + * this event. This parameter must not be null. + * @param dependencies An array of String filters for each + * dependency associated with this event. Must be a non-empty array + * for event types {@link #GRACE_PERIOD} and (@link #WAITING}. It + * is optional for {@link #FAILURE} event types. + * Must be null for other event types. + * @param cause A Throwable object describing the root cause of + * this event. May be null. + */ + public BlueprintEvent(int type, Bundle bundle, Bundle extenderBundle, + String[] dependencies, Throwable cause) { + this.type = type; + this.timestamp = System.currentTimeMillis(); + this.bundle = bundle; + this.extenderBundle = extenderBundle; + this.dependencies = dependencies == null ? null + : (String[]) dependencies.clone();; + this.cause = cause; + this.replay = false; + if (bundle == null) { + throw new NullPointerException("bundle must not be null"); + } + if (extenderBundle == null) { + throw new NullPointerException("extenderBundle must not be null"); + } + switch (type) { + case WAITING : + case GRACE_PERIOD : + if (dependencies == null) { + throw new NullPointerException( + "dependencies must not be null"); + } + if (dependencies.length == 0) { + throw new IllegalArgumentException( + "dependencies must not be length zero"); + } + break; + case FAILURE : + // not all FAILURE events have a dependency list, but if there + // is one, it must be non-empty. + if (dependencies != null) { + if (dependencies.length == 0) { + throw new IllegalArgumentException( + "dependencies must not be length zero"); + } + } + break; + default : + if (dependencies != null) { + throw new IllegalArgumentException( + "dependencies must be null"); + } + break; + } + } + + /** + * Create a new BlueprintEvent from the specified + * BlueprintEvent. The timestamp property will be + * copied from the original event and only the replay property will be + * overridden with the given value. + * + * @param event The original BlueprintEvent to copy. Must not + * be null. + * @param replay true if this event should be used as a replay + * event. + */ + public BlueprintEvent(BlueprintEvent event, boolean replay) { + this.type = event.type; + this.timestamp = event.timestamp; + this.bundle = event.bundle; + this.extenderBundle = event.extenderBundle; + this.dependencies = event.dependencies; + this.cause = event.cause; + this.replay = replay; + } + + /** + * Return the type of this event. + *

+ * The type values are: + *

    + *
  • {@link #CREATING}
  • + *
  • {@link #CREATED}
  • + *
  • {@link #DESTROYING}
  • + *
  • {@link #DESTROYED}
  • + *
  • {@link #FAILURE}
  • + *
  • {@link #GRACE_PERIOD}
  • + *
  • {@link #WAITING}
  • + *
+ * + * @return The type of this event. + */ + public int getType() { + return type; + } + + /** + * Return the time at which this event was created. + * + * @return The time at which this event was created. + */ + public long getTimestamp() { + return timestamp; + } + + /** + * Return the Blueprint bundle associated with this event. + * + * @return The Blueprint bundle associated with this event. + */ + public Bundle getBundle() { + return bundle; + } + + /** + * Return the Blueprint extender bundle that is generating this event. + * + * @return The Blueprint extender bundle that is generating this event. + */ + public Bundle getExtenderBundle() { + return extenderBundle; + } + + /** + * Return the filters identifying the missing dependencies that caused this + * event. + * + * @return The filters identifying the missing dependencies that caused this + * event if the event type is one of {@link #WAITING}, + * {@link #GRACE_PERIOD} or {@link #FAILURE} or null + * for the other event types. + */ + public String[] getDependencies() { + return dependencies == null ? null : (String[]) dependencies.clone(); + } + + /** + * Return the cause for this {@link #FAILURE} event. + * + * @return The cause of the failure for this event. May be null + * . + */ + public Throwable getCause() { + return cause; + } + + /** + * Return whether this event is a replay event. + * + * @return true if this event is a replay event and + * false otherwise. + */ + public boolean isReplay() { + return replay; + } +} Added: aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,52 @@ +/* + * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved. + * + * Licensed 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.osgi.service.blueprint.container; + +/** + * A BlueprintEvent Listener. + * + *

+ * To receive Blueprint Events, a bundle must register a Blueprint Listener + * service. + * + * After a Blueprint Listener is registered, the Blueprint extender must + * synchronously send to this Blueprint Listener the last Blueprint Event for + * each ready Blueprint bundle managed by this extender. This replay of + * Blueprint Events is designed so that the new Blueprint Listener can be + * informed of the state of each Blueprint bundle. Blueprint Events sent during + * this replay will have the {@link BlueprintEvent#isReplay() isReplay()} flag + * set. The Blueprint extender must ensure that this replay phase does not + * interfere with new Blueprint Events so that the chronological order of all + * Blueprint Events received by the Blueprint Listener is preserved. If the last + * Blueprint Event for a given Blueprint bundle is + * {@link BlueprintEvent#DESTROYED DESTROYED}, the extender must not send it + * during this replay phase. + * + * @see BlueprintEvent + * @ThreadSafe + * @version $Revision: 792499 $ + */ +public interface BlueprintListener { + + /** + * Receives notifications of a Blueprint Event. + * + * Implementers should quickly process the event and return. + * + * @param event The {@link BlueprintEvent}. + */ + void blueprintEvent(BlueprintEvent event); +} Added: aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java URL: http://svn.apache.org/viewvc/aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java?rev=1075143&view=auto ============================================================================== --- aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java (added) +++ aries/tags/blueprint-0.2.1/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ComponentDefinitionException.java Sun Feb 27 20:50:38 2011 @@ -0,0 +1,65 @@ +/* + * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved. + * + * Licensed 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.osgi.service.blueprint.container; + +/** + * A Blueprint exception indicating that a component definition is in error. + * + * This exception is thrown when a configuration-related error occurs during + * creation of a Blueprint Container. + * + * @version $Revision: 791585 $ + */ +public class ComponentDefinitionException extends RuntimeException { + private static final long serialVersionUID = 1L; + + /** + * Creates a Component Definition Exception with no message or exception + * cause. + */ + public ComponentDefinitionException() { + super(); + } + + /** + * Creates a Component Definition Exception with the specified message + * + * @param explanation The associated message. + */ + public ComponentDefinitionException(String explanation) { + super(explanation); + } + + /** + * Creates a Component Definition Exception with the specified message and + * exception cause. + * + * @param explanation The associated message. + * @param cause The cause of this exception. + */ + public ComponentDefinitionException(String explanation, Throwable cause) { + super(explanation, cause); + } + + /** + * Creates a Component Definition Exception with the exception cause. + * + * @param cause The cause of this exception. + */ + public ComponentDefinitionException(Throwable cause) { + super(cause); + } +}