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/06/10 18:06:54 UTC

svn commit: r783411 - in /geronimo/sandbox/blueprint: blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/ blueprint-core/src/main/java/org/apache/geronimo/blueprint/con...

Author: gnodet
Date: Wed Jun 10 16:06:51 2009
New Revision: 783411

URL: http://svn.apache.org/viewvc?rev=783411&view=rev
Log:
Update to latest api

Modified:
    geronimo/sandbox/blueprint/blueprint-api/src/main/java/org/osgi/service/blueprint/reflect/ServiceReferenceMetadata.java
    geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefListRecipe.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableServiceReferenceMetadata.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/RefListMetadataImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ReferenceMetadataImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceReferenceMetadataImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd

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=783411&r1=783410&r2=783411&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 Wed Jun 10 16:06:51 2009
@@ -27,7 +27,7 @@
     
     int getAvailability();
 
-    List<String> getInterfaceNames();
+    String getInterfaceName();
 
     String getComponentName();
     

Modified: geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java (original)
+++ geronimo/sandbox/blueprint/blueprint-cm/src/main/java/org/apache/geronimo/blueprint/compendium/cm/CmNamespaceHandler.java Wed Jun 10 16:06:51 2009
@@ -280,11 +280,11 @@
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (isBlueprintNamespace(e.getNamespaceURI())) {
-                    if (nodeNameEquals(e, Parser.INTERFACES_ELEMENT)) {
+                    if (nodeNameEquals(e, INTERFACES_ELEMENT)) {
                         if (interfaces != null) {
                             throw new ComponentDefinitionException("Only one of " + Parser.INTERFACE_ATTRIBUTE + " attribute or " + INTERFACES_ELEMENT + " element must be used");
                         }
-                        interfaces = parser.parseInterfaceNames(e);
+                        interfaces = parseInterfaceNames(e);
                         factoryMetadata.addProperty("interfaces", createList(context, interfaces));                    
                     } else if (nodeNameEquals(e, Parser.SERVICE_PROPERTIES_ELEMENT)) { 
                         MapMetadata map = parser.parseServiceProperties(e, factoryMetadata);
@@ -404,7 +404,7 @@
         if (registry.getComponentDefinition(CONFIG_ADMIN_REFERENCE_NAME) == null) {
             MutableReferenceMetadata reference = context.createMetadata(MutableReferenceMetadata.class);
             reference.setId(CONFIG_ADMIN_REFERENCE_NAME);
-            reference.addInterfaceName(ConfigurationAdmin.class.getName());
+            reference.setInterfaceName(ConfigurationAdmin.class.getName());
             reference.setAvailability(ReferenceMetadata.AVAILABILITY_MANDATORY);
             reference.setTimeout(300000);
             registry.registerComponentDefinition(reference);
@@ -503,4 +503,25 @@
         throw new RuntimeException("Unable to get parser");
     }
 
+    public List<String> parseInterfaceNames(Element element) {
+        List<String> interfaceNames = new ArrayList<String>();
+        NodeList nl = element.getChildNodes();
+        for (int i = 0; i < nl.getLength(); i++) {
+            Node node = nl.item(i);
+            if (node instanceof Element) {
+                Element e = (Element) node;
+                if (nodeNameEquals(e, VALUE_ELEMENT)) {
+                    String v = getTextValue(e).trim();
+                    if (interfaceNames.contains(v)) {
+                        throw new ComponentDefinitionException("The element " + INTERFACES_ELEMENT + " should not contain the same interface twice");
+                    }
+                    interfaceNames.add(getTextValue(e));
+                } else {
+                    throw new ComponentDefinitionException("Unsupported element " + e.getNodeName() + " inside an " + INTERFACES_ELEMENT + " element");
+                }
+            }
+        }
+        return interfaceNames;
+    }
+
 }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/AbstractServiceReferenceRecipe.java Wed Jun 10 16:06:51 2009
@@ -56,7 +56,8 @@
 /**
  * Abstract class for service reference recipes.
  *
- * TODO: handle dependsOn on references
+ * TODO: if we have a single interface (which is the standard behavior), then we should be able to get rid of
+ *       the proxyClassloader and just use this interface classloader to define the proxy
  *
  * @author <a href="mailto:dev@geronimo.apache.org">Apache Geronimo Project</a>
  * @version $Rev: 760378 $, $Date: 2009-03-31 11:31:38 +0200 (Tue, 31 Mar 2009) $
@@ -98,7 +99,7 @@
         // TODO: use a doPrivileged block 
         this.proxyClassLoader = new BundleDelegatingClassLoader(blueprintContainer.getBundleContext().getBundle(),
                                                                 getClass().getClassLoader());
-        
+
         this.optional = (metadata.getAvailability() == ReferenceMetadata.AVAILABILITY_OPTIONAL);
         this.filter = createOsgiFilter(metadata);
     }
@@ -169,7 +170,7 @@
             if (listenersRecipe != null) {
                 listeners = (List<Listener>) listenersRecipe.create();
                 for (Listener listener : listeners) {
-                    listener.init(loadAllClasses(metadata.getInterfaceNames()));
+                    listener.init(loadAllClasses(Collections.singletonList(metadata.getInterfaceName())));
                 }
             } else {
                 listeners = Collections.emptyList();
@@ -198,7 +199,7 @@
             if (metadata instanceof ExtendedServiceReferenceMetadata) {
                 proxyClass = (((ExtendedServiceReferenceMetadata) metadata).getProxyMethod() & ExtendedServiceReferenceMetadata.PROXY_METHOD_CLASSES) != 0;
             }
-            List<Class> classes = loadAllClasses(this.metadata.getInterfaceNames());
+            List<Class> classes = loadAllClasses(Collections.singletonList(this.metadata.getInterfaceName()));
             if (!proxyClass) {
                 for (Class cl : classes) {
                     if (!cl.isInterface()) {
@@ -415,7 +416,8 @@
             members.add(flt);
         }
         // Handle interfaces
-        Set<String> interfaces = new HashSet<String>(metadata.getInterfaceNames());
+        Set<String> interfaces = new HashSet<String>();
+        interfaces.add(metadata.getInterfaceName());
         if (!interfaces.isEmpty()) {
             for (String itf : interfaces) {
                 members.add("(" + Constants.OBJECTCLASS + "=" + itf + ")");

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/Parser.java Wed Jun 10 16:06:51 2009
@@ -125,7 +125,6 @@
     public static final String SERVICE_ELEMENT = "service";
     public static final String REFERENCE_ELEMENT = "reference";
     public static final String REFLIST_ELEMENT = "ref-list";
-    public static final String INTERFACES_ELEMENT = "interfaces";
     public static final String LISTENER_ELEMENT = "listener";
     public static final String SERVICE_PROPERTIES_ELEMENT = "service-properties";
     public static final String REGISTRATION_LISTENER_ELEMENT = "registration-listener";
@@ -595,12 +594,7 @@
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (isBlueprintNamespace(e.getNamespaceURI())) {
-                    if (nodeNameEquals(e, INTERFACES_ELEMENT)) {
-                        if (hasInterfaceNameAttribute) {
-                            throw new ComponentDefinitionException("Only one of " + INTERFACE_ATTRIBUTE + " attribute or " + INTERFACES_ELEMENT + " element must be used");
-                        }
-                        service.setInterfaceNames(parseInterfaceNames(e));
-                    } else if (nodeNameEquals(e, SERVICE_PROPERTIES_ELEMENT)) {
+                    if (nodeNameEquals(e, SERVICE_PROPERTIES_ELEMENT)) {
                         List<MapEntry> entries = parseServiceProperties(e, service).getEntries();
                         service.setServiceProperties(entries); 
                     } else if (nodeNameEquals(e, REGISTRATION_LISTENER_ELEMENT)) {
@@ -919,7 +913,7 @@
             reference.setDependsOn(parseList(element.getAttribute(DEPENDS_ON_ATTRIBUTE)));
         }
         if (element.hasAttribute(INTERFACE_ATTRIBUTE)) {
-            reference.setInterfaceNames(Collections.singletonList(element.getAttribute(INTERFACE_ATTRIBUTE)));
+            reference.setInterfaceName(element.getAttribute(INTERFACE_ATTRIBUTE));
         }
         if (element.hasAttribute(FILTER_ATTRIBUTE)) {
             reference.setFilter(element.getAttribute(FILTER_ATTRIBUTE));
@@ -942,12 +936,7 @@
             if (node instanceof Element) {
                 Element e = (Element) node;
                 if (isBlueprintNamespace(e.getNamespaceURI())) {
-                    if (nodeNameEquals(e, INTERFACES_ELEMENT)) {
-                        if (reference.getInterfaceNames() != null) {
-                            throw new ComponentDefinitionException("Only one of " + INTERFACE_ATTRIBUTE + " attribute or " + INTERFACES_ELEMENT + " element must be used");
-                        }
-                        reference.setInterfaceNames(parseInterfaceNames(e));
-                    } else if (nodeNameEquals(e, LISTENER_ELEMENT)) {
+                    if (nodeNameEquals(e, LISTENER_ELEMENT)) {
                         reference.addServiceListener(parseServiceListener(e, reference));
                     }
                 }
@@ -1022,27 +1011,6 @@
         return listener;
     }
 
-    public List<String> parseInterfaceNames(Element element) {
-        List<String> interfaceNames = new ArrayList<String>();
-        NodeList nl = element.getChildNodes();
-        for (int i = 0; i < nl.getLength(); i++) {
-            Node node = nl.item(i);
-            if (node instanceof Element) {
-                Element e = (Element) node;
-                if (nodeNameEquals(e, VALUE_ELEMENT)) {
-                    String v = getTextValue(e).trim();
-                    if (interfaceNames.contains(v)) {
-                        throw new ComponentDefinitionException("The element " + INTERFACES_ELEMENT + " should not contain the same interface twice");
-                    }
-                    interfaceNames.add(getTextValue(e));
-                } else {
-                    throw new ComponentDefinitionException("Unsupported element " + e.getNodeName() + " inside an " + INTERFACES_ELEMENT + " element");
-                }
-            }
-        }
-        return interfaceNames;
-    }
-
     private Metadata parseArgumentOrPropertyValue(Element element, ComponentMetadata enclosingComponent) {
         // TODO: we should ensure there is only a single element or ref attribute defined here
         if (element.hasAttribute(REF_ATTRIBUTE)) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefListRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefListRecipe.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefListRecipe.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/RefListRecipe.java Wed Jun 10 16:06:51 2009
@@ -28,6 +28,7 @@
 import java.util.List;
 import java.util.ListIterator;
 import java.util.RandomAccess;
+import java.util.Collections;
 import java.util.concurrent.Callable;
 
 import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
@@ -128,7 +129,7 @@
                     }
                 } else {
                     dispatcher = new ServiceDispatcher(reference);
-                    List<String> interfaces = metadata.getInterfaceNames();
+                    List<String> interfaces = Collections.singletonList(metadata.getInterfaceName());
                     if (metadata instanceof ExtendedRefListMetadata) {
                         boolean greedy = (((ExtendedRefListMetadata) metadata).getProxyMethod() & ExtendedRefListMetadata.PROXY_METHOD_GREEDY) != 0;
                         if (greedy) {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/ReferenceRecipe.java Wed Jun 10 16:06:51 2009
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.Type;
 import java.util.List;
+import java.util.Collections;
 import java.util.concurrent.Callable;
 
 import org.apache.geronimo.blueprint.ExtendedBlueprintContainer;
@@ -70,7 +71,7 @@
                 }
             }
             // Create the proxy
-            proxy = createProxy(new ServiceDispatcher(), this.metadata.getInterfaceNames());
+            proxy = createProxy(new ServiceDispatcher(), Collections.singletonList(this.metadata.getInterfaceName()));
 
             // Add partially created proxy to the context
             ServiceProxyWrapper wrapper = new ServiceProxyWrapper();

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableServiceReferenceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableServiceReferenceMetadata.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableServiceReferenceMetadata.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/mutable/MutableServiceReferenceMetadata.java Wed Jun 10 16:06:51 2009
@@ -32,9 +32,7 @@
 
     void setAvailability(int availability);
 
-    void addInterfaceName(String interfaceName);
-
-    void removeInterfaceName(String interfaceName);
+    void setInterfaceName(String interfaceName);
 
     void setComponentName(String componentName);
 

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/RefListMetadataImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/RefListMetadataImpl.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/RefListMetadataImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/RefListMetadataImpl.java Wed Jun 10 16:06:51 2009
@@ -54,7 +54,7 @@
                 ", initialization=" + initialization +
                 ", dependsOn=" + dependsOn +
                 ", availability=" + availability +
-                ", interfaceNames=" + interfaceNames +
+                ", interfaceName='" + interfaceName + '\'' +
                 ", componentName='" + componentName + '\'' +
                 ", filter='" + filter + '\'' +
                 ", serviceListeners=" + serviceListeners +

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ReferenceMetadataImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ReferenceMetadataImpl.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ReferenceMetadataImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ReferenceMetadataImpl.java Wed Jun 10 16:06:51 2009
@@ -54,7 +54,7 @@
                 ", initialization=" + initialization +
                 ", dependsOn=" + dependsOn +
                 ", availability=" + availability +
-                ", interfaceNames=" + interfaceNames +
+                ", interfaceName='" + interfaceName + '\'' +
                 ", componentName='" + componentName + '\'' +
                 ", filter='" + filter + '\'' +
                 ", serviceListeners=" + serviceListeners +

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceReferenceMetadataImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceReferenceMetadataImpl.java?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceReferenceMetadataImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/reflect/ServiceReferenceMetadataImpl.java Wed Jun 10 16:06:51 2009
@@ -37,7 +37,7 @@
 public abstract class ServiceReferenceMetadataImpl extends ComponentMetadataImpl implements MutableServiceReferenceMetadata {
 
     protected int availability;
-    protected List<String> interfaceNames;
+    protected String interfaceName;
     protected String componentName;
     protected String filter;
     protected Collection<Listener> serviceListeners;
@@ -49,7 +49,7 @@
     public ServiceReferenceMetadataImpl(ServiceReferenceMetadata source) {
         super(source);
         this.availability = source.getAvailability();
-        this.interfaceNames = new ArrayList<String>(source.getInterfaceNames());
+        this.interfaceName = source.getInterfaceName();
         this.componentName = source.getComponentName();
         this.filter = source.getFilter();
         for (Listener listener : source.getServiceListeners()) {
@@ -65,25 +65,12 @@
         this.availability = availability;
     }
 
-    public List<String> getInterfaceNames() {
-        return interfaceNames;
+    public String getInterfaceName() {
+        return interfaceName;
     }
 
-    public void setInterfaceNames(List<String> interfaceNames) {
-        this.interfaceNames = interfaceNames != null ? new ArrayList<String>(interfaceNames) : null;
-    }
-
-    public void addInterfaceName(String interfaceName) {
-        if (this.interfaceNames == null) {
-            this.interfaceNames = new ArrayList<String>();
-        }
-        this.interfaceNames.add(interfaceName);
-    }
-
-    public void removeInterfaceName(String interfaceName) {
-        if (this.interfaceNames != null) {
-            this.interfaceNames.remove(interfaceName);
-        }
+    public void setInterfaceName(String interfaceName) {
+        this.interfaceName = interfaceName;
     }
 
     public String getComponentName() {

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd?rev=783411&r1=783410&r2=783411&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/resources/org/apache/geronimo/blueprint/blueprint.xsd Wed Jun 10 16:06:51 2009
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!--
     /*
-    * $Revision: 7279 $
+    * $Revision: 7333 $
     *
     * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
     *
@@ -131,8 +131,8 @@
                 <xsd:documentation>
                   <![CDATA[
                   Specifies the default initialization setting that will be defined
-                  for components.  If not specified, the global
-                  default is "eager".  Individual components may
+                  for <bean> components.  If not specified, the global
+                  default is "eager".  Individual <bean> components may
                   override the default
                   ]]>
                 </xsd:documentation>
@@ -422,7 +422,7 @@
                 <xsd:attribute name="id" use="prohibited"/>
                 <xsd:attribute name="depends-on" type="TdependsOn" use="optional"/>
                 <xsd:attribute name="initialization" use="prohibited"/>
-                <xsd:attribute name="interface" type="Tclass" use="optional"/>
+                <xsd:attribute name="interface" type="Tclass" use="required"/>
                 <xsd:attribute name="filter" type="xsd:normalizedString" use="optional"/>
                 <xsd:attribute name="component-name" type="Tidref" use="optional"/>
                 <xsd:attribute name="availability" type="Tavailability" use="optional"/>
@@ -484,7 +484,7 @@
                 <xsd:attribute name="id" use="prohibited"/>
                 <xsd:attribute name="depends-on" type="TdependsOn" use="optional"/>
                 <xsd:attribute name="initialization" use="prohibited"/>
-                <xsd:attribute name="interface" type="Tclass" use="optional"/>
+                <xsd:attribute name="interface" type="Tclass" use="required"/>
                 <xsd:attribute name="filter" type="xsd:normalizedString" use="optional"/>
                 <xsd:attribute name="component-name" type="Tidref" use="optional"/>
                 <xsd:attribute name="availability" type="Tavailability" use="optional"/>
@@ -511,7 +511,7 @@
                     <xsd:group ref="serviceReferenceElements"/>
                 </xsd:sequence>
 
-                <xsd:attribute name="interface" use="optional" type="Tclass" />
+                <xsd:attribute name="interface" use="required" type="Tclass" />
                 <xsd:attribute name="filter" use="optional" type="xsd:normalizedString">
                     <xsd:annotation>
                         <xsd:documentation>
@@ -556,18 +556,6 @@
     <xsd:group name="serviceReferenceElements">
         <xsd:sequence>
             <xsd:element name="description" type="Tdescription" minOccurs="0" />
-            <xsd:element name="interfaces" minOccurs="0" maxOccurs="1" type="Tinterfaces">
-                <xsd:annotation>
-                    <xsd:documentation>
-                  <![CDATA[
-                  The definition of the required interfaces that the obtained services
-                  must implement.   There is also a shortcut attribute defined for
-                  the typical case of just a single interface class.
-                  ]]>
-                    </xsd:documentation>
-                </xsd:annotation>
-            </xsd:element>
-
             <!-- listener -->
             <xsd:element name="listener" type="TreferenceListener" minOccurs="0"
                 maxOccurs="unbounded">
@@ -1054,8 +1042,7 @@
         <xsd:annotation>
             <xsd:documentation>
               <![CDATA[
-              The type definition for the <interfaces> element used for <service>,
-              <reference> and <ref-list>;
+              The type definition for the <interfaces> element used for <service>
               ]]>
             </xsd:documentation>
         </xsd:annotation>