You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gn...@apache.org on 2009/07/09 13:07:00 UTC
svn commit: r792499 - in /geronimo/sandbox/blueprint:
blueprint-api/src/main/java/org/osgi/service/blueprint/container/
blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/
blueprint-core/src/main/java/org/apache/geronimo/blueprint/container...
Author: gnodet
Date: Thu Jul 9 11:06:59 2009
New Revision: 792499
URL: http://svn.apache.org/viewvc?rev=792499&view=rev
Log:
Update to latest javadoc
Added:
geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/test/
geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/test/Context.java
Modified:
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ReifiedType.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Target.java
geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java
geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java
geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintEvent.java Thu Jul 9 11:06:59 2009
@@ -205,7 +205,7 @@
/**
* Create a <code>BlueprintEvent</code> object associated with a failure
- * cause and related to a set of dependencies.
+ * cause and a set of dependencies.
*
* @param type The type of this event.
* @param bundle The Blueprint bundle associated with this event. This
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/BlueprintListener.java Thu Jul 9 11:06:59 2009
@@ -22,17 +22,18 @@
* 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
+ * 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()} 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}, the
- * extender must not send it during this replay phase.
+ * 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
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/Converter.java Thu Jul 9 11:06:59 2009
@@ -43,8 +43,8 @@
* @return An instance with a type that is assignable from targetType's raw
* class
* @throws Exception If the conversion cannot succeed. This exception should
- * not be thrown when the {@link #canConvert} method has returned
- * <code>true</code>.
+ * not be thrown when the {@link #canConvert canConvert} method has
+ * returned <code>true</code>.
*/
Object convert(Object sourceObject, ReifiedType targetType)
throws Exception;
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/EventConstants.java Thu Jul 9 11:06:59 2009
@@ -19,10 +19,13 @@
* Event property names used in Event Admin events published by a Blueprint
* Container.
*
+ * <p>
* Each type of event is sent to a different topic:
*
+ * <p>
* <code>org/osgi/service/blueprint/container/</code><em><event-type></em>
*
+ * <p>
* where <em><event-type></em> can have the values
* {@link BlueprintEvent#CREATING CREATING}, {@link BlueprintEvent#CREATED
* CREATED}, {@link BlueprintEvent#DESTROYING DESTROYING},
@@ -30,6 +33,7 @@
* FAILURE}, {@link BlueprintEvent#GRACE_PERIOD GRACE_PERIOD}, or
* {@link BlueprintEvent#WAITING WAITING}.
*
+ * <p>
* Such events have the following properties:
* <ul>
* <li>{@link #TYPE type}</li>
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ReifiedType.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ReifiedType.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ReifiedType.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/container/ReifiedType.java Thu Jul 9 11:06:59 2009
@@ -18,6 +18,7 @@
/**
* Provides access to a concrete type and its optional generic type parameters.
*
+ * <p>
* Java 5 and later support generic types. These types consist of a raw class
* with type parameters. This class models such a <code>Type</code> class but
* ensures that the type is <em>reified</em>. Reification means that the Type
@@ -26,11 +27,13 @@
* {@link #getRawClass()} method. The optional type parameters are recursively
* represented as Reified Types.
*
+ * <p>
* In Java 1.4, a class has by definition no type parameters. This class
* implementation provides the Reified Type for Java 1.4 by making the raw class
* the Java 1.4 class and using a Reified Type based on the <code>Object</code>
* class for any requested type parameter.
*
+ * <p>
* A Blueprint extender implementations can subclass this class and provide
* access to the generic type parameter graph for conversion. Such a subclass
* must <em>reify</em> the different Java 5 <code>Type</code> instances into the
@@ -65,7 +68,7 @@
* example:
*
* <pre>
- * Map<String, ? extends Metadata> map;
+ * Map<String, ? extends Metadata>
* </pre>
*
* The raw class is the Map class.
@@ -85,7 +88,7 @@
* For example, in the following example:
*
* <pre>
- * Map<String, ? extends Metadata> map;
+ * Map<String, ? extends Metadata>
* </pre>
*
* type parameter 0 is <code>String</code>, and type parameter 1 is
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanArgument.java Thu Jul 9 11:06:59 2009
@@ -16,10 +16,10 @@
package org.osgi.service.blueprint.reflect;
/**
- * Metadata for a Bean Manager to describe the injection of arguments in a
- * method or constructor, it is obtained from the
- * {@link BeanMetadata#getArguments()}. This Metadata class describes the
- * <code>argument</code> element of the <code>bean</code> element.
+ * Metadata for a factory method or constructor argument of a bean. The
+ * arguments of a bean are obtained from {@link BeanMetadata#getArguments()}.
+ *
+ * This is specified by the <code>argument</code> elements of a bean.
*
* @ThreadSafe
* @version $Revision$
@@ -27,38 +27,36 @@
public interface BeanArgument {
/**
- * The Metadata for the value to inject into the argument.
+ * Return the Metadata for the argument value.
*
- * This is the <code>value</code> attribute.
+ * This is specified by the <code>value</code> attribute.
*
- * @return the Metadata for the value
+ * @return The Metadata for the argument value.
*/
Metadata getValue();
/**
- * The type to match the argument and convert the value into when invoking
- * the constructor or factory method. If no explicit type was specified on
- * the definition then this method returns <code>null</code>.
+ * Return the name of the value type to match the argument and convert the
+ * value into when invoking the constructor or factory method.
*
- * This is the <code>type</code> attribute.
+ * This is specified by the <code>type</code> attribute.
*
- * @return the explicitly specified type to convert the value into, or
- * <code>null</code> if no type was specified in the definition.
+ * @return The name of the value type to convert the value into, or
+ * <code>null</code> if no type is specified.
*/
String getValueType();
/**
- * The (zero-based) index into the parameter list of the method or
- * constructor to be invoked for this argument. This is determined either by
- * explicitly specifying the <code>index</code> attribute in the component
- * declaration. If not explicitly set, this will return -1 and the initial
- * ordering is defined by its position in the
- * {@link BeanMetadata#getArguments()} list.
+ * Return the zero-based index into the parameter list of the factory method
+ * or constructor to be invoked for this argument. This is determined by
+ * specifying the <code>index</code> attribute for the bean. If not
+ * explicitly set, this will return -1 and the initial ordering is defined
+ * by its position in the {@link BeanMetadata#getArguments()} list.
*
- * This is the <code>index</code> attribute.
+ * This is specified by the <code>index</code> attribute.
*
- * @return the zero-based parameter index, or -1 if the argument position
- * was not set.
+ * @return The zero-based index of the parameter, or -1 if no index is
+ * specified.
*/
int getIndex();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanMetadata.java Thu Jul 9 11:06:59 2009
@@ -18,7 +18,10 @@
import java.util.List;
/**
- * Metadata for a Bean Manager.
+ * Metadata for a Bean component.
+ *
+ * <p>
+ * This is specified by the <code>bean</code> element.
*
* @ThreadSafe
* @version $Revision$
@@ -26,108 +29,113 @@
public interface BeanMetadata extends Target, ComponentMetadata {
/**
- * Used when the <code>scope</code> is <code>singleton</code>. See
- * {@link #getScope()}
+ * The bean has <code>singleton</code> scope.
+ *
+ * @see #getScope()
*/
+ static final String SCOPE_SINGLETON = "singleton";
- static final String SCOPE_SINGLETON = "singleton";
/**
- * Used when the <code>scope</code> is <code>prototype</code> See
- * {@link #getScope()}
+ * The bean has <code>prototype</code> scope.
+ *
+ * @see #getScope()
*/
- static final String SCOPE_PROTOTYPE = "prototype";
+ static final String SCOPE_PROTOTYPE = "prototype";
/**
- * The name of the class specified for this bean.
+ * Return the name of the class specified for the bean.
*
- * This is the <code>class</code> attribute.
+ * This is specified by the <code>class</code> attribute of the bean
+ * definition.
*
- * @return the name of the bean class. If no class was specified in the
- * definition (because the a factory component is used instead) then
- * this method will return <code>null</code>.
+ * @return The name of the class specified for the bean. If no class is
+ * specified in the bean definition, because the a factory component
+ * is used instead, then this method will return <code>null</code>.
*/
String getClassName();
/**
- * The name of the init method specified for this bean, if any.
+ * Return the name of the init method specified for the bean.
*
- * This is the <code>init-method</code> attribute.
+ * This is specified by the <code>init-method</code> attribute of the bean
+ * definition.
*
- * @return the method name of the specified init method, or
- * <code>null</code> if no init method was specified.
+ * @return The name of the init method specified for the bean, or
+ * <code>null</code> if no init method is specified.
*/
String getInitMethod();
/**
- * The name of the destroy method specified for this bean, if any.
+ * Return the name of the destroy method specified for the bean.
*
- * This is the <code>destroy-method</code> attribute.
+ * This is specified by the <code>destroy-method</code> attribute of the
+ * bean definition.
*
- * @return the method name of the specified destroy method, or
- * <code>null</code> if no destroy method was specified.
+ * @return The name of the destroy method specified for the bean, or
+ * <code>null</code> if no destroy method is specified.
*/
String getDestroyMethod();
/**
- * The arguments for the factory method or constructor.
+ * Return the arguments for the factory method or constructor of the bean.
*
- * Specified in all the child
- * <code>argument<code> elements. The return is a list of {@link BeanArgument} objects.
+ * This is specified by the child <code>argument<code> elements.
*
- * @return List of Bean Arguments for the factory method or constructor, can
- * be empty if no arguments are specified
+ * @return An immutable List of {@link BeanArgument} objects for the factory
+ * method or constructor of the bean. The List is empty if no
+ * arguments are specified for the bean.
*/
List<BeanArgument> getArguments();
/**
- * The property injection {@link BeanProperty} Metadata for this bean.
+ * Return the properties for the bean.
*
- * Specified in all the child <code>property</code> elements.
+ * This is specified by the child <code>property</code> elements.
*
- * @return an immutable List of {@link BeanProperty}, with one entry for
- * each property to be injected. If no property injection was
- * specified for this bean then an empty List will be returned.
+ * @return An immutable List of {@link BeanProperty} objects, with one entry
+ * for each property to be injected in the bean. The List is empty
+ * if no property injection is specified for the bean.
*
*/
List<BeanProperty> getProperties();
/**
- * Provides the name of the optional factory method.
+ * Return the name of the factory method for the bean.
*
- * This is the <code>factory-method</code> attribute.
+ * This is specified by the <code>factory-method</code> attribute of the
+ * bean.
*
- * @return The name of the factory method or <code>null</code>.
+ * @return The name of the factory method of the bean or <code>null</code>
+ * if no factory method is specified for the bean.
*/
String getFactoryMethod();
/**
- * The component instance on which to invoke the factory method (if
- * specified).
+ * Return the Metadata for the factory component on which to invoke the
+ * factory method for the bean.
*
- * The to be used component instance is referred to by the
- * <code>factory-component</code>.
+ * This is specified by the <code>factory-ref</code> attribute of the bean.
*
- * When a factory method and factory ref has been specified for this
- * component, this operation returns the Metadata specifying the manager on
- * which component instance the factory method is to be invoked. When no
- * factory component has been specified this operation will return
- * <code>null</code>.
- *
- * A return value of <code>null with a <code>non-null</code> factory method
- * indicates that the factory method should be invoked as a static method on
- * the given class itself. For a <code>non-null</code> return value, the
- * Metadata returned will be a {@link Target} instance.
- *
- * @return A {@link Target} or <code>null</code> if no factory component was
- * specified.
+ * <p>
+ * When a factory method and factory component have been specified for the
+ * bean, this method returns the factory component on which to invoke the
+ * factory method for the bean. When no factory component has been specified
+ * this method will return <code>null</code>.
+ *
+ * When a factory method has been specified for the bean but a factory
+ * component has not been specified, the factory method must be invoked as a
+ * static method on the bean's class.
+ *
+ * @return The Metadata for the factory component on which to invoke the
+ * factory method for the bean or <code>null</code> if no factory
+ * component is specified.
*/
Target getFactoryComponent();
/**
- * The specified scope for the manager's lifecycle.
- *
- * @return The scope specified for the component.
+ * Return the scope for the bean.
*
+ * @return The scope for the bean.
* @see #SCOPE_SINGLETON
* @see #SCOPE_PROTOTYPE
*/
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/BeanProperty.java Thu Jul 9 11:06:59 2009
@@ -16,8 +16,11 @@
package org.osgi.service.blueprint.reflect;
/**
- * Metadata describing a property to be injected. Properties are defined
- * according to the Java Beans conventions.
+ * Metadata for a property to be injected into a bean. The properties of a bean
+ * are obtained from {@link BeanMetadata#getProperties()}.
+ *
+ * This is specified by the <code>property</code> elements of a bean. Properties
+ * are defined according to the Java Beans conventions.
*
* @ThreadSafe
* @version $Revision$
@@ -25,21 +28,21 @@
public interface BeanProperty {
/**
- * The name of the property to be injected, following Java Beans
- * conventions.
+ * Return the name of the property to be injected. The name follows Java
+ * Beans conventions.
*
- * Defined in the <code>name</code> attribute.
+ * This is specified by the <code>name</code> attribute.
*
- * @return the property name.
+ * @return The name of the property to be injected.
*/
String getName();
/**
- * The Metadata for the value to inject the property with.
+ * Return the Metadata for the value to be injected into a bean.
*
- * Defined in the <code>value</code> attribute or in an inlined definition.
+ * This is specified by the <code>value</code> attribute or in inlined text.
*
- * @return the Metadata for the property value.
+ * @return The Metadata for the value to be injected into a bean.
*/
Metadata getValue();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/CollectionMetadata.java Thu Jul 9 11:06:59 2009
@@ -18,9 +18,9 @@
import java.util.List;
/**
- * Metadata for a collection based value. Members of the collection are
- * instances of Metadata. This Collection Metadata can constrain the members of
- * its collection to a specific type.
+ * Metadata for a collection based value. Values of the collection are defined
+ * by Metadata objects. This Collection Metadata can constrain the values of the
+ * collection to a specific type.
*
* @ThreadSafe
* @version $Revision$
@@ -29,30 +29,29 @@
public interface CollectionMetadata extends NonNullMetadata {
/**
- * Provide the interface that this collection must implement.
+ * Return the type of the collection.
*
- * This is used for <code>Arrays (Object[])</code>, <code>Set</code>,
- * and <code>List</code>. This information is encoded in the element
- * name.
+ * The possible types are: array (<code>Object[]</code>), <code>Set</code>,
+ * and <code>List</code>. This information is specified in the element name.
*
- * @return The interface class that the collection must implement or
- * <code>Object[]</code> for arrays.
+ * @return The type of the collection. <code>Object[]</code> is returned to
+ * indicate an array.
*/
Class<?> getCollectionClass();
/**
- * The value-type specified for the members of the collection or array.
+ * Return the type specified for the values of the collection.
*
- * The <code>value-type</code> attribute.
+ * The <code>value-type</code> attribute specified this information.
*
- * @return The value type for this Collection Metadata
+ * @return The type specified for the values of the collection.
*/
String getValueType();
/**
- * The Metadata that describe the member values of the Collection or array.
+ * Return Metadata for the values of the collection.
*
- * @return A list of Metadata for the values of a collection or array.
+ * @return A List of Metadata for the values of the collection.
*/
List<Metadata> getValues();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ComponentMetadata.java Thu Jul 9 11:06:59 2009
@@ -18,54 +18,58 @@
import java.util.List;
/**
- * Base class for all managers.
+ * Metadata for managed components. This is the base type for
+ * {@link BeanMetadata}, {@link ServiceMetadata} and
+ * {@link ServiceReferenceMetadata}.
*
- * @see BeanMetadata
- * @see ServiceReferenceMetadata
- * @see ServiceMetadata
- * @see Target
* @ThreadSafe
* @version $Revision$
*/
public interface ComponentMetadata extends NonNullMetadata {
/**
- * The manager will be eagerly activate
+ * The component's manager must eagerly activate the component.
+ *
+ * @see #getActivation()
*/
static final int ACTIVATION_EAGER = 1;
/**
- * The manager will be lazily activated
+ * The component's manager must lazily activate the component.
+ *
+ * @see #getActivation()
*/
static final int ACTIVATION_LAZY = 2;
/**
- * The id of the manager.
+ * Return the id of the component.
*
- * @return manager id. The manager id can be <code>null</code> if this is an
- * anonymously defined and/or inlined manager.
+ * @return The id of the component. The component id can be
+ * <code>null</code> if this is an anonymously defined and/or
+ * inlined component.
*/
String getId();
/**
- * Activation strategy for this manager.
+ * Return the activation strategy for the component.
*
- * This is the <code>activation</code> attribute or the
- * <code>default-activation</code> in the <code>blueprint</code> element if
- * not set. If this is also not set, it is {@link #ACTIVATION_EAGER}.
+ * This is specified by the <code>activation</code> attribute of a component
+ * definition. If this is not set, then the <code>default-activation</code>
+ * in the <code>blueprint</code> element is used. If that is also not set,
+ * then the activation strategy is {@link #ACTIVATION_EAGER}.
*
- * @return the activation method
+ * @return The activation strategy for the component.
* @see #ACTIVATION_EAGER
* @see #ACTIVATION_LAZY
*/
int getActivation();
/**
- * The id of any managers listed in a <code>depends-on</code> attribute for
- * this manager.
+ * Return the ids of any components listed in a <code>depends-on</code>
+ * attribute for the component.
*
- * @return an immutable List of manager ids that are explicitly declared as
- * a dependency, or an empty List if none.
+ * @return An immutable List of component ids that are explicitly declared
+ * as a dependency, or an empty List if none.
*/
List<String> getDependsOn();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/IdRefMetadata.java Thu Jul 9 11:06:59 2009
@@ -16,19 +16,21 @@
package org.osgi.service.blueprint.reflect;
/**
- * A value which represents the verified id of another manager in the Blueprint
- * Container. The id itself will be injected, not the manager that the id refers
- * to. No implicit dependency is created.
+ * Metadata for the verified id of another component managed by the Blueprint
+ * Container. The id itself will be injected, not the component to which the id
+ * refers. No implicit dependency is created.
*
* @ThreadSafe
* @version $Revision$
*/
public interface IdRefMetadata extends NonNullMetadata {
/**
- * The id of the referenced manager. Defined in the
- * <code>component-id</code> attribute.
+ * Return the id of the referenced component.
*
- * @return The referred manager id.
+ * This is specified by the <code>component-id</code> attribute of a
+ * component.
+ *
+ * @return The id of the referenced component.
*/
String getComponentId();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapEntry.java Thu Jul 9 11:06:59 2009
@@ -17,31 +17,32 @@
package org.osgi.service.blueprint.reflect;
/**
- * Metadata for a map entry. A map entry is the member of a {@link MapMetadata} List, so
- * that it can be treated as a {@link CollectionMetadata} with entries.
+ * Metadata for a map entry.
*
- * Defined in the <code>entry</code> element.
+ * This type is used by {@link MapMetadata}, {@link PropsMetadata} and
+ * {@link ServiceMetadata}.
*
* @ThreadSafe
* @version $Revision$
*/
public interface MapEntry {
/**
- * Keys must be <code>non-null</code>.
+ * Return the Metadata for the key of the map entry.
*
- * Defined in the <code>key</code> attribute or element.
+ * This is specified by the <code>key</code> attribute or element.
*
- * @return the Metadata for the key
+ * @return The Metadata for the key of the map entry. This must not be
+ * <code>null</code>.
*/
NonNullMetadata getKey();
/**
- * Return the Metadata for the value.
+ * Return the Metadata for the value of the map entry.
*
- * Defined in the <code>value</code> attribute or element<.
+ * This is specified by the <code>value</code> attribute or element.
*
- * @return the Metadata for the value
+ * @return The Metadata for the value of the map entry. This must not be
+ * <code>null</code>.
*/
-
Metadata getValue();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/MapMetadata.java Thu Jul 9 11:06:59 2009
@@ -18,37 +18,41 @@
import java.util.List;
/**
- * A Map-based value. This represented as a Collection of {@link MapEntry}.
+ * Metadata for a Map based value.
*
- * A Map is defined in the <code>map</code> element.
+ * <p>
+ * This is specified by the <code>map</code> element.
*
* @ThreadSafe
* @version $Revision$
*/
public interface MapMetadata extends NonNullMetadata {
/**
- * The key-type specified for map keys, or <code>null</code> if none given
+ * Return the name of the type of the map keys.
*
- * Defined in the <code>key-type</code> attribute.
+ * This is specified by the <code>key-type</code> attribute of the map.
*
- * @return The key type name
+ * @return The name of the type of the map keys, or <code>null</code> if
+ * none is specified.
*/
String getKeyType();
/**
- * The value-type specified for the value.
+ * Return the name of the type of the map values.
*
- * The <code>value-type</code> attribute.
+ * This is specified by the <code>value-type</code> attribute of the map.
*
- * @return The value type name
+ * @return The name of the type of the map values, or <code>null</code> if
+ * none is specified.
*/
String getValueType();
/**
- * The Metadata that describe the value.
+ * Return the entries for the map.
*
- * @return A list of {@link MapEntry} objects describing the
- * <code>Map<code> contents.
+ * @return An immutable List of {@link MapEntry} objects for each entry in
+ * the map. The List is empty if no entries are specified for the
+ * map.
*/
List<MapEntry> getEntries();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Metadata.java Thu Jul 9 11:06:59 2009
@@ -16,7 +16,7 @@
package org.osgi.service.blueprint.reflect;
/**
- * Top level Metadata.
+ * Top level Metadata type. All Metdata types extends this base type.
*
* @ThreadSafe
* @version $Revision$
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NonNullMetadata.java Thu Jul 9 11:06:59 2009
@@ -16,9 +16,12 @@
package org.osgi.service.blueprint.reflect;
/**
- * Base interfaces for Metadata that cannot result in a <code>null</code> value.
- * The {@link NullMetadata} is the only element not implementing this. Mainly
- * used for keys in Maps because they cannot be <code>null</code>.
+ * Metadata for a value that cannot <code>null</code>. All Metadata subtypes
+ * extend this type except for {@link NullMetadata}.
+ *
+ * <p>
+ * This Metadata type is used for keys in Maps because they cannot be
+ * <code>null</code>.
*
* @ThreadSafe
* @version $Revision$
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/NullMetadata.java Thu Jul 9 11:06:59 2009
@@ -16,7 +16,8 @@
package org.osgi.service.blueprint.reflect;
/**
- * A value specified to be <code>null</code> via the <null/> element.
+ * Metadata for a value specified to be <code>null</code> via the <null>
+ * element.
*
* @ThreadSafe
* @version $Revision$
@@ -24,7 +25,7 @@
public interface NullMetadata extends Metadata {
/**
- * Singleton instance of the <code>NULL</code> Metadata.
+ * Singleton instance of <code>NullMetadata</code>.
*/
static final NullMetadata NULL = new NullMetadata() {
// empty body
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/PropsMetadata.java Thu Jul 9 11:06:59 2009
@@ -18,10 +18,14 @@
import java.util.List;
/**
- * A <code>java.util.Properties</code> based value. The properties are defined
- * as string to string.
+ * Metadata for a <code>java.util.Properties</code> based value.
*
- * Defined in the <code>props</code> element.
+ * <p>
+ * The {@link MapEntry} objects of properties are defined with keys and values
+ * of type <code>String</code>.
+ *
+ * <p>
+ * This is specified by the <code>props</code> element.
*
* @ThreadSafe
* @version $Revision$
@@ -29,9 +33,11 @@
public interface PropsMetadata extends NonNullMetadata {
/**
- * Defined in <code>prop</code> elements.
+ * Return the entries for the properties.
*
- * @return List of <code>MapEntry</code> objects, never <code>null</code>
+ * @return An immutable List of {@link MapEntry} objects for each entry in
+ * the properties. The List is empty if no entries are specified for
+ * the properties.
*/
List<MapEntry> getEntries();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RefMetadata.java Thu Jul 9 11:06:59 2009
@@ -16,18 +16,20 @@
package org.osgi.service.blueprint.reflect;
/**
- * A value which refers by its id to another manager in the Blueprint Container.
+ * Metadata for a reference to another component managed by the Blueprint
+ * Container.
*
* @ThreadSafe
* @version $Revision$
*/
public interface RefMetadata extends Target, NonNullMetadata {
/**
- * The id of the referenced manager. Defined in the
- * <code>component-id</code> attribute.
+ * Return the id of the referenced component.
*
- * @return The component id
+ * This is specified by the <code>component-id</code> attribute of a
+ * component.
*
+ * @return The id of the referenced component.
*/
String getComponentId();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListMetadata.java Thu Jul 9 11:06:59 2009
@@ -16,7 +16,10 @@
package org.osgi.service.blueprint.reflect;
/**
- * A reference-list Metadata.
+ * Metadata for a list of service references.
+ *
+ * <p>
+ * This is specified by the <code>reference-list</code> element.
*
* @ThreadSafe
* @version $Revision$
@@ -24,20 +27,28 @@
public interface ReferenceListMetadata extends ServiceReferenceMetadata {
/**
- * The List member types must be the proxies to the service objects
+ * Reference list values must be proxies to the actual service objects.
+ *
+ * @see #getMemberType()
*/
- public static final int USE_SERVICE_OBJECT = 1;
+ static final int USE_SERVICE_OBJECT = 1;
/**
- * The List member types must be Service Reference objects
+ * Reference list values must be <code>ServiceReference</code> objects.
+ *
+ * @see #getMemberType()
*/
- public static final int USE_SERVICE_REFERENCE = 2;
+ static final int USE_SERVICE_REFERENCE = 2;
/**
- * Whether the collection will contain service objects, or service
- * references Defined in the <code>member-type</code> attribute.
+ * Return whether the List will contain service object proxies or
+ * <code>ServiceReference</code> objects.
+ *
+ * This is specified by the <code>member-type</code> attribute of the
+ * reference list.
*
- * @return one of {@link #USE_SERVICE_OBJECT} and {@link #USE_SERVICE_REFERENCE}
+ * @return Whether the List will contain service object proxies or
+ * <code>ServiceReference</code> objects.
* @see #USE_SERVICE_OBJECT
* @see #USE_SERVICE_REFERENCE
*/
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceListener.java Thu Jul 9 11:06:59 2009
@@ -25,29 +25,36 @@
public interface ReferenceListener {
/**
- * The component instance that will receive bind and unbind events. The
- * returned value must reference a {@link Target} either directly or
- * indirectly.
+ * Return the Metadata for the component that will receive bind and unbind
+ * events.
*
- * Defined in the <code>ref</code> attribute or via an inlined manager.
+ * This is specified by the <code>ref</code> attribute or via an inlined
+ * component.
*
- * @return the listener component instance Metadata.
+ * @return The Metadata for the component that will receive bind and unbind
+ * events.
*/
Target getListenerComponent();
/**
- * The name of the method to invoke on the reference listener when a
- * matching service is bound to the reference
+ * Return the name of the bind method. The bind method will be invoked when
+ * a matching service is bound to the reference.
*
- * @return the bind callback method name.
+ * This is specified by the <code>bind-method</code> attribute of the
+ * reference listener.
+ *
+ * @return The name of the bind method.
*/
String getBindMethod();
/**
- * The name of the method to invoke on the reference listener when a service
- * is unbound from the reference.
+ * Return the name of the unbind method. The unbind method will be invoked
+ * when a matching service is unbound from the reference.
+ *
+ * This is specified by the <code>unbind-method</code> attribute of the
+ * reference listener.
*
- * @return the unbind callback method name.
+ * @return The name of the unbind method.
*/
String getUnbindMethod();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ReferenceMetadata.java Thu Jul 9 11:06:59 2009
@@ -16,22 +16,25 @@
package org.osgi.service.blueprint.reflect;
/**
+ * Metadata for a reference that will bind to a single matching service in the
+ * service registry.
*
- * A reference that will bind to a single matching service in the service
- * registry.
- *
- * Defines the <code>reference</code> element.
+ * <p>
+ * This is specified by the <code>reference</code> element.
*
* @ThreadSafe
* @version $Revision$
*/
-public interface ReferenceMetadata extends ServiceReferenceMetadata, Target {
+public interface ReferenceMetadata extends Target, ServiceReferenceMetadata {
/**
- * Timeout for service invocations when a backing service is is unavailable.
- * Defined in the <code>timeout</code> attribute.
+ * Return the timeout for service invocations when a backing service is is
+ * unavailable.
+ *
+ * This is specified by the <code>timeout</code> attribute of the reference.
*
- * @return service invocation timeout in milliseconds
+ * @return The timeout, in milliseconds, for service invocations when a
+ * backing service is is unavailable.
*/
long getTimeout();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/RegistrationListener.java Thu Jul 9 11:06:59 2009
@@ -17,8 +17,11 @@
/**
* Metadata for a registration listener interested in service registration and
- * unregistration events. Available from the
- * {@link ServiceMetadata#getRegistrationListeners()} method.
+ * unregistration events for a service.
+ *
+ * <p>
+ * The registration listener is called with the initial state of the service
+ * when the registration listener is actuated.
*
* @ThreadSafe
* @version $Revision$
@@ -26,38 +29,38 @@
public interface RegistrationListener {
/**
- * The component instance that will receive registration and unregistration
- * events. The returned value must reference a {@link Target} either
- * directly or indirectly. The return type will be a {@link Target}
- * instance.
+ * Return the Metadata for the component that will receive registration and
+ * unregistration events.
*
- * Defined in the <code>registration-listener</code> child element of the
- * <code>service</code> element.
+ * This is specified by the <code>ref</code> attribute or via an inlined
+ * component.
*
- * @return The registration listener target.
+ * @return The Metadata for the component that will receive registration and
+ * unregistration events.
*/
Target getListenerComponent();
/**
- * The name of the method to invoke on the registration listener when the
- * associated service is registered with the service registry. This method
- * is also be called with the initial state when the listener is actuated.
+ * Return the name of the registration method. The registration method will
+ * be invoked when the associated service is registered with the service
+ * registry.
*
- * Defined in the <code>registration-method</code> attribute.
+ * This is specified by the <code>registration-method</code> attribute of
+ * the registration listener.
*
- * @return The registration callback method name.
+ * @return The name of the registration method.
*/
String getRegistrationMethod();
/**
- * The name of the method to invoke on the listener component when the
- * exported service is unregistered from the service registry. This method
- * can also be called with the initial state when the listener is actuated.
+ * Return the name of the unregistration method. The unregistration method
+ * will be invoked when the associated service is unregistered from the
+ * service registry.
*
- * Defined in the <code>unregistration-method</code> attribute.
+ * This is specified by the <code>unregistration-method</code> attribute of
+ * the registration listener.
*
- * @return the unregistration callback method name.
+ * @return The name of the unregistration method.
*/
String getUnregistrationMethod();
-
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java Thu Jul 9 11:06:59 2009
@@ -19,9 +19,12 @@
import java.util.List;
/**
- * Metadata representing a service to registered by the Blueprint Container when
+ * Metadata for a service to be registered by the Blueprint Container when
* enabled.
*
+ * <p>
+ * This is specified by the <code>service</code> element.
+ *
* @ThreadSafe
* @version $Revision$
*/
@@ -32,7 +35,7 @@
*
* @see #getAutoExport()
*/
- public static final int AUTO_EXPORT_DISABLED = 1;
+ static final int AUTO_EXPORT_DISABLED = 1;
/**
* Advertise all Java interfaces implemented by the component instance type
@@ -40,7 +43,7 @@
*
* @see #getAutoExport()
*/
- public static final int AUTO_EXPORT_INTERFACES = 2;
+ static final int AUTO_EXPORT_INTERFACES = 2;
/**
* Advertise all Java classes in the hierarchy of the component instance
@@ -48,7 +51,7 @@
*
* @see #getAutoExport()
*/
- public static final int AUTO_EXPORT_CLASS_HIERARCHY = 3;
+ static final int AUTO_EXPORT_CLASS_HIERARCHY = 3;
/**
* Advertise all Java classes and interfaces in the component instance type
@@ -56,69 +59,80 @@
*
* @see #getAutoExport()
*/
- public static final int AUTO_EXPORT_ALL_CLASSES = 4;
+ static final int AUTO_EXPORT_ALL_CLASSES = 4;
/**
- * The component that is to be exported as a service. Value must refer to a
- * component and therefore be a {@link Target}.
+ * Return the Metadata for the component to be exported as a service.
*
- * Defined inline or via the <code>ref</code> attribute.
+ * This is specified inline or via the <code>ref</code> attribute of the
+ * service.
*
- * @return the component to be exported as a service.
+ * @return The Metadata for the component to be exported as a service.
*/
Target getServiceComponent();
/**
- * The type names of the set of interfaces that the service should be
+ * Return the type names of the interfaces that the service should be
* advertised as supporting.
*
- * Defined in the <code>interface</code> attribute or
- * <code>interfaces</code> element.
+ * This is specified in the <code>interface</code> attribute or child
+ * <code>interfaces</code> element of the service.
*
- * @return an immutable set of (<code>String</code>) interface names, or
- * an empty set if using <code>auto-export</code> or not set.
+ * @return An immutable List of <code>String</code> for the type names of
+ * the interfaces that the service should be advertised as
+ * supporting. The List is empty if using <code>auto-export</code>
+ * or no interface names are specified for the service.
*/
List<String> getInterfaces();
/**
- * Return the auto-export mode specified.
+ * Return the auto-export mode for the service.
*
- * Defined in the <code>auto-export</code> attribute.
+ * This is specified by the <code>auto-export</code> attribute of the
+ * service.
*
- * @return One of {@link #AUTO_EXPORT_DISABLED},
- * {@link #AUTO_EXPORT_INTERFACES},
- * {@link #AUTO_EXPORT_CLASS_HIERARCHY},
- * {@link #AUTO_EXPORT_ALL_CLASSES}
+ * @return The auto-export mode for the service.
+ * @see #AUTO_EXPORT_DISABLED
+ * @see #AUTO_EXPORT_INTERFACES
+ * @see #AUTO_EXPORT_CLASS_HIERARCHY
+ * @see #AUTO_EXPORT_ALL_CLASSES
*/
int getAutoExport();
/**
- * The user declared properties to be advertised with the service.
+ * Return the user declared properties to be advertised with the service.
*
- * Defined in the <code>service-properties</code> element.
+ * This is specified by the <code>service-properties</code> element of the
+ * service.
*
- * @return <code>List</code> containing {@link MapEntry} objects, can be
- * empty.
+ * @return An immutable List of {@link MapEntry} objects for the user
+ * declared properties to be advertised with the service. The List
+ * is empty if no service properties are specified for the service.
*/
List<MapEntry> getServiceProperties();
/**
- * The ranking value to use when advertising the service. If this value is
- * zero, no ranking service property must be registered.
+ * Return the ranking value to use when advertising the service. If the
+ * ranking value is zero, the service must be registered without a
+ * <code>service.ranking</code> service property.
*
- * Defined in the <code>ranking</code> attribute.
+ * This is specified by the <code>ranking</code> attribute of the service.
*
- * @return service ranking
+ * @return The ranking value to use when advertising the service.
*/
int getRanking();
/**
- * The registration listeners to be notified when the service is registered
- * and unregistered with the framework.
+ * Return the registration listeners to be notified when the service is
+ * registered and unregistered with the framework.
*
- * Defined in the <code>registration-listener</code> elements.
+ * This is specified by the <code>registration-listener</code> elements of
+ * the service.
*
- * @return an immutable collection of {@link RegistrationListener}
+ * @return An immutable Collection of {@link RegistrationListener} objects
+ * to be notified when the service is registered and unregistered
+ * with the framework. The Collection is empty if no registration
+ * listeners are specified for the service.
*/
Collection<RegistrationListener> getRegistrationListeners();
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java Thu Jul 9 11:06:59 2009
@@ -18,7 +18,8 @@
import java.util.Collection;
/**
- * Metadata describing a reference to an OSGi service.
+ * Metadata for a reference to an OSGi service. This is the base type for
+ * {@link ReferenceListMetadata} and {@link ReferenceMetadata}.
*
* @ThreadSafe
* @version $Revision$
@@ -30,66 +31,72 @@
*
* @see #getAvailability()
*/
- public static final int AVAILABILITY_MANDATORY = 1;
+ static final int AVAILABILITY_MANDATORY = 1;
/**
* A matching service is not required to be present.
*
* @see #getAvailability()
*/
- public static final int AVAILABILITY_OPTIONAL = 2;
+ static final int AVAILABILITY_OPTIONAL = 2;
/**
- * Whether or not a matching service is required at all times.
+ * Return whether or not a matching service is required at all times.
*
- * Defined in the <code>availability</code> attribute.
+ * This is specified in the <code>availability</code> attribute of the
+ * service reference.
*
- * @return one of {@link #AVAILABILITY_MANDATORY} or
- * {@link #AVAILABILITY_OPTIONAL}
+ * @return Whether or not a matching service is required at all times.
+ * @see #AVAILABILITY_MANDATORY
+ * @see #AVAILABILITY_OPTIONAL
*/
int getAvailability();
/**
- * The interface type that the matching service must support
+ * Return the name of the interface type that a matching service must
+ * support.
*
- * Defined in the <code>interface</code> attribute.
+ * This is specified in the <code>interface</code> attribute of the service
+ * reference.
*
- * @return the name of the requested service interface or <code>null</code>
- * when no interface name is defined.
+ * @return The name of the interface type that a matching service must
+ * support or <code>null</code> when no interface name is specified.
*/
String getInterface();
/**
- * The value of the <code>component-name</code> attribute, if specified.
- * This specifies the id of a component that is registered in the service
- * registry. This will create an automatic filter (appended with the filter
- * if set) to select this component based on its automatic <code>id</code>
- * attribute.
- *
- * Defined in the <code>component-name</code> attribute.
- *
- * @return the <code>component-name</code> attribute value, or
- * <code>null</code> if the attribute was not specified
+ * Return the value of the <code>component-name</code> attribute of the
+ * service reference. This specifies the id of a component that is
+ * registered in the service registry. This will create an automatic filter,
+ * appended with the filter if set, to select this component based on its
+ * automatic <code>id</code> attribute.
+ *
+ * @return The value of the <code>component-name</code> attribute of the
+ * service reference or <code>null</code> if the attribute is not
+ * specified.
*/
String getComponentName();
/**
- * The filter expression that a matching service must pass
+ * Return the filter expression that a matching service must match.
*
- * Defined in the <code>filter</code> attribute.
+ * This is specified by the <code>filter</code> attribute of the service
+ * reference.
*
- * @return An OSGi filter expression
+ * @return The filter expression that a matching service must match or
+ * <code>null</code> if a filter is not specified.
*/
String getFilter();
/**
- * The set of registration listeners defined to receive bind and unbind
- * events.
+ * Return the reference listeners to receive bind and unbind events.
*
- * Defined in the <code>registration-listener</code> element.
+ * This is specified by the <code>reference-listener</code> elements of the
+ * service reference.
*
- * @return an immutable collection of {@link ReferenceListener} objects
+ * @return An immutable Collection of {@link ReferenceListener} objects to
+ * receive bind and unbind events. The Collection is empty if no
+ * reference listeners are specified for the service reference.
*/
Collection<ReferenceListener> getReferenceListeners();
-
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Target.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Target.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Target.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/Target.java Thu Jul 9 11:06:59 2009
@@ -16,9 +16,10 @@
package org.osgi.service.blueprint.reflect;
/**
- * Provides a common interface for managers that can be used as a direct target
+ * A common interface for managed components that can be used as a direct target
* for method calls. These are <code>bean</code>, <code>reference</code>, and
- * <code>ref</code>, where the <code>ref</code> must refer to a bean or reference manager.
+ * <code>ref</code>, where the <code>ref</code> must refer to a bean or
+ * reference component.
*
* @see BeanMetadata
* @see ReferenceMetadata
@@ -26,6 +27,6 @@
* @ThreadSafe
* @version $Revision$
*/
-public interface Target extends Metadata {
+public interface Target extends NonNullMetadata {
// marker interface
}
Modified: geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ValueMetadata.java Thu Jul 9 11:06:59 2009
@@ -16,30 +16,30 @@
package org.osgi.service.blueprint.reflect;
/**
- * A simple <code>String</code> value that will be type-converted if necessary
- * before injecting.
- *
- * This class is representing the <code>value</code> element.
+ * Metadata for a simple <code>String</code> value that will be type-converted
+ * if necessary before injecting.
*
* @ThreadSafe
* @version $Revision$
*/
public interface ValueMetadata extends NonNullMetadata {
/**
- * The string value (unconverted) of this value.
+ * Return the unconverted string representation of the value.
*
- * Defined in the <code>value</code> attribute or text part of the
+ * This is specified by the <code>value</code> attribute or text part of the
* <code>value</code> element.
*
- * @return The content of the <code>value</code>
+ * @return The unconverted string representation of the value.
*/
String getStringValue();
/**
- * The name of the type to which this value should be converted. May be
- * <code>null</code>. Defined in the <code>type</code> attribute.
+ * Return the name of the type to which the value should be converted.
+ *
+ * This is specified by the <code>type</code> attribute.
*
- * @return Optional class name for this value
+ * @return The name of the type to which the value should be converted or
+ * <code>null</code> if no type is specified.
*/
String getType();
}
Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java Thu Jul 9 11:06:59 2009
@@ -51,7 +51,7 @@
private static final Logger LOGGER = LoggerFactory.getLogger(BlueprintEventDispatcher.class);
- private final ServiceTracker eventAdminServiceTracker;
+ private final BlueprintListener eventAdminListener;
private final ServiceTracker containerListenerTracker;
private final Map<Bundle, BlueprintEvent> states;
private final ExecutorService executor;
@@ -59,16 +59,14 @@
public BlueprintEventDispatcher(final BundleContext bundleContext) {
this.states = new ConcurrentHashMap<Bundle, BlueprintEvent>();
this.executor = Executors.newSingleThreadExecutor();
- ServiceTracker eaTracker = null;
+ BlueprintListener listener = null;
try {
- eaTracker = new EvenAdminDispatcher(bundleContext);
- } catch (NoClassDefFoundError e) {
+ getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
+ listener = new EventAdminListener(bundleContext);
+ } catch (Throwable t) {
// Ignore, if the EventAdmin package is not available, just don't use it
}
- this.eventAdminServiceTracker = eaTracker;
- if (this.eventAdminServiceTracker != null) {
- this.eventAdminServiceTracker.open();
- }
+ this.eventAdminListener = listener;
this.containerListenerTracker = new ServiceTracker(bundleContext, BlueprintListener.class.getName(), new ServiceTrackerCustomizer() {
public Object addingService(ServiceReference reference) {
BlueprintListener listener = (BlueprintListener) bundleContext.getService(reference);
@@ -100,8 +98,8 @@
executor.submit(new Runnable() {
public void run() {
callListeners(event);
- if (BlueprintEventDispatcher.this.eventAdminServiceTracker instanceof BlueprintListener) {
- ((BlueprintListener) BlueprintEventDispatcher.this.eventAdminServiceTracker).blueprintEvent(event);
+ if (eventAdminListener != null) {
+ eventAdminListener.blueprintEvent(event);
}
}
});
@@ -152,20 +150,20 @@
public void destroy() {
this.executor.shutdown();
- if (this.eventAdminServiceTracker != null) {
- this.eventAdminServiceTracker.close();
- }
this.containerListenerTracker.close();
}
- static class EvenAdminDispatcher extends ServiceTracker implements BlueprintListener {
+ static class EventAdminListener implements BlueprintListener {
- EvenAdminDispatcher(BundleContext context) {
- super(context, EventAdmin.class.getName(), null);
+ private ServiceTracker tracker;
+
+ public EventAdminListener(BundleContext context) {
+ tracker = new ServiceTracker(context, EventAdmin.class.getName(), null);
+ tracker.open();
}
public void blueprintEvent(BlueprintEvent event) {
- EventAdmin eventAdmin = (EventAdmin) getService();
+ EventAdmin eventAdmin = (EventAdmin) tracker.getService();
if (eventAdmin == null) {
return;
}
@@ -225,4 +223,5 @@
}
}
+
}
Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java?rev=792499&r1=792498&r2=792499&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ServiceRecipe.java Thu Jul 9 11:06:59 2009
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.geronimo.blueprint.BlueprintConstants;
import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
@@ -60,20 +61,20 @@
private static final Logger LOGGER = LoggerFactory.getLogger(ServiceRecipe.class);
- private ExtendedBlueprintContainer blueprintContainer;
- private ServiceMetadata metadata;
- private Recipe serviceRecipe;
- private CollectionRecipe listenersRecipe;
- private MapRecipe propertiesRecipe;
- private List<Recipe> explicitDependencies;
+ private final ExtendedBlueprintContainer blueprintContainer;
+ private final ServiceMetadata metadata;
+ private final Recipe serviceRecipe;
+ private final CollectionRecipe listenersRecipe;
+ private final MapRecipe propertiesRecipe;
+ private final List<Recipe> explicitDependencies;
+ private final boolean prototypeService;
private Map properties;
- private boolean registered;
- private ServiceRegistration registration;
+ private final AtomicBoolean registered = new AtomicBoolean();
+ private volatile ServiceRegistration registration;
private Map registrationProperties;
private List<ServiceListener> listeners;
private Object service;
- private boolean prototypeService;
public ServiceRecipe(String name,
ExtendedBlueprintContainer blueprintContainer,
@@ -130,9 +131,12 @@
return proxy;
}
- public synchronized void register() {
- if (!isRegistered()) {
- registered = true;
+ public boolean isRegistered() {
+ return registered.get();
+ }
+
+ public void register() {
+ if (registered.compareAndSet(false, true)) {
Hashtable props = new Hashtable();
if (properties == null) {
properties = (Map) createRecipe(propertiesRecipe);
@@ -160,11 +164,27 @@
}
}
- public synchronized boolean isRegistered() {
- return registered;
+ public void unregister() {
+ if (registered.compareAndSet(true, false)) {
+ LOGGER.debug("Unregistering service {}", name);
+ // This method needs to allow reentrance, so if we need to make sure the registration is
+ // set to null before actually unregistering the service
+ ServiceRegistration reg = registration;
+ if (listeners != null) {
+ LOGGER.debug("Calling listeners for service unregistration");
+ for (ServiceListener listener : listeners) {
+ listener.unregister(service instanceof ServiceFactory || !prototypeService ? service : null, registrationProperties);
+ }
+ }
+ reg.unregister();
+ // We need to do this hack in order to support reantrancy
+ if (registration == reg) {
+ registration = null;
+ }
+ }
}
- public synchronized ServiceReference getReference() {
+ protected ServiceReference getReference() {
if (registration == null) {
throw new IllegalStateException("Service is not registered");
} else {
@@ -172,7 +192,7 @@
}
}
- public synchronized void setProperties(Dictionary props) {
+ protected void setProperties(Dictionary props) {
if (registration == null) {
throw new IllegalStateException("Service is not registered");
} else {
@@ -182,27 +202,6 @@
}
- public synchronized void unregister() {
- if (isRegistered()) {
- registered = false;
- LOGGER.debug("Unregistering service {}", name);
- // This method needs to allow reentrance, so if we need to make sure the registration is
- // set to null before actually unregistering the service
- ServiceRegistration reg = registration;
- if (listeners != null) {
- LOGGER.debug("Calling listeners for service unregistration");
- for (ServiceListener listener : listeners) {
- listener.unregister(service instanceof ServiceFactory || !prototypeService ? service : null, registrationProperties);
- }
- }
- reg.unregister();
- // We need to do this hack in order to support reantrancy
- if (registration == reg) {
- registration = null;
- }
- }
- }
-
protected Object internalGetService() {
return internalGetService(blueprintContainer.getBundleContext().getBundle(), null);
}
@@ -236,7 +235,7 @@
listeners = Collections.emptyList();
}
LOGGER.debug("Listeners created: {}", listeners);
- if (registered) { // Do not call isRegistered() because of the synchronization
+ if (registered.get()) {
LOGGER.debug("Calling listeners for initial service registration");
for (ServiceListener listener : listeners) {
listener.register(service instanceof ServiceFactory || !prototypeService ? service : null,
@@ -409,9 +408,9 @@
}
public void updateProperties(Dictionary properties) {
- Hashtable table = JavaUtils.getProperties(getReference());
+ Hashtable table = JavaUtils.getProperties(ServiceRecipe.this.getReference());
JavaUtils.copy(table, properties);
- setProperties(table);
+ ServiceRecipe.this.setProperties(table);
}
}
Added: geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/test/Context.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/test/Context.java?rev=792499&view=auto
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/test/Context.java (added)
+++ geronimo/sandbox/blueprint/blueprint-core/src/test/java/org/apache/geronimo/blueprint/test/Context.java Thu Jul 9 11:06:59 2009
@@ -0,0 +1,124 @@
+package org.apache.geronimo.blueprint.test;
+
+import org.w3c.dom.Element;
+
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.Target;
+import org.osgi.service.blueprint.reflect.BeanArgument;
+import org.osgi.service.blueprint.reflect.BeanProperty;
+import org.osgi.service.blueprint.reflect.CollectionMetadata;
+import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceListMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceListener;
+
+public class Context {
+
+ interface Builder<M extends Metadata, B extends Builder<M, B>> {
+ M metadata();
+ }
+
+ interface ComponentBuilder<M extends ComponentMetadata, B extends ComponentBuilder<M, B>> extends Builder<M, B> {
+ B id(String id);
+ B activation(int activation);
+ B dependsOn(String dependsOn);
+ B removeDependsOn(String dependsOn);
+ B clearDependsOn();
+ }
+
+ interface BeanBuilder extends ComponentBuilder<BeanMetadata, BeanBuilder> {
+ BeanBuilder className(String className);
+ BeanBuilder initMethod(String initMethod);
+ BeanBuilder destroyMethod(String destroyMethod);
+ BeanBuilder argument(BeanArgument argument);
+ BeanBuilder argument(Metadata value);
+ BeanBuilder argument(Metadata value, String valueType);
+ BeanBuilder argument(Metadata value, int index);
+ BeanBuilder argument(Metadata value, String valueType, int index);
+ BeanBuilder removeArgument(BeanArgument argument);
+ BeanBuilder clearArguments();
+ BeanBuilder property(BeanProperty property);
+ BeanBuilder property(String name, Metadata value);
+ BeanBuilder removeProperty(BeanProperty property);
+ BeanBuilder clearProperties();
+ BeanBuilder factoryMethod(String factoryMethod);
+ BeanBuilder factoryComponent(Target factoryComponent);
+ BeanBuilder scope(String scope);
+ }
+
+ interface ServiceReferenceBuilder<M extends ServiceReferenceMetadata, B extends ServiceReferenceBuilder<M,B>> extends ComponentBuilder<M,B> {
+ B availability(int availability);
+ B interfaceName(String interfaceName);
+ B componentName(String componentName);
+ B filter(String filter);
+ B listener(ReferenceListener listener);
+ B listener(Target listenerComponent, String bindMethod, String unbindMethod);
+ B removeListener(ReferenceListener listener);
+ B clearListeners();
+ }
+
+ interface ReferenceBuilder extends ServiceReferenceBuilder<ReferenceMetadata, ReferenceBuilder> {
+ long timeout(long timeout);
+ }
+
+ interface ReferenceListBuilder extends ServiceReferenceBuilder<ReferenceListMetadata, ReferenceListBuilder> {
+ ReferenceListBuilder memberType(int memberType);
+ }
+
+ interface CollectionBuilder extends Builder<CollectionMetadata, CollectionBuilder> {
+ CollectionBuilder collectionClass(Class<?> collectionClass);
+ CollectionBuilder valueType(String valueType);
+ CollectionBuilder value(Metadata value);
+ CollectionBuilder removeValue(Metadata value);
+ CollectionBuilder clearValues();
+ }
+
+ interface ServiceBuilder extends ComponentBuilder<ServiceMetadata, ServiceBuilder> {
+ ServiceBuilder serviceComponent(Target target);
+ // TODO
+ }
+
+ interface ParserContext {
+ <M extends Metadata> M parse(ParserContext context, Element node, Class<M> type);
+ <M extends Metadata> M metadata(Class<M> metadata);
+ <M extends Metadata, B extends Builder<M, B>> B builder(Class<B> type, M metadata);
+ }
+
+ void test() {
+ ParserContext ctx = getParserContext();
+
+ BeanBuilder beanBuilder = ctx.builder(BeanBuilder.class, ctx.metadata(BeanMetadata.class));
+
+
+ beanBuilder.id("id").activation(ComponentMetadata.ACTIVATION_EAGER).className("className");
+
+ BeanMetadata bean = ctx.metadata(BeanMetadata.class);
+ beanBuilder = ctx.builder(BeanBuilder.class, bean);
+ beanBuilder.dependsOn("dependOn");
+
+ ServiceBuilder serviceBuilder = ctx.builder(ServiceBuilder.class, ctx.metadata(ServiceMetadata.class));
+ serviceBuilder.id("id");
+ }
+
+ public <T extends Metadata> T parse(ParserContext context, Element node, Class<T> type) {
+ assert ComponentMetadata.class.isAssignableFrom(type);
+ BeanBuilder beanBuilder = context.builder(BeanBuilder.class, context.metadata(BeanMetadata.class));
+ beanBuilder.className("foo.bar.TraceBean");
+ Element innerBeanElement = getInnerBeanElement(node);
+ BeanMetadata innerBean = context.parse(context, innerBeanElement, BeanMetadata.class);
+ beanBuilder.argument(innerBean);
+ return type.cast(beanBuilder.metadata());
+ }
+
+ ParserContext getParserContext() {
+ return null;
+ }
+
+ Element getInnerBeanElement(Element node) {
+ return null;
+ }
+
+}