Commit 2020ea1d authored by Lionel Seinturier's avatar Lionel Seinturier

Fix for the management of collection interfaces with the binding controller.

parent ee80e010
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2013 Inria, Univ. Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Lionel Seinturier
*/
package org.ow2.frascati.tinfi.control.binding
import org.objectweb.fractal.api.`type`.InterfaceType
import org.objectweb.fractal.api.Interface
import org.objectweb.fractal.julia.control.binding.AbstractBindingControllerTrait
import org.objectweb.fractal.julia.control.binding.BasicBindingControllerTrait
import org.objectweb.fractal.julia.BasicControllerTrait
import org.objectweb.fractal.julia.UseComponentTrait
/**
* This trait removes collection interface instances from the map of bindings.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.4.6
*/
trait CollectionInterfaceBindingControllerTrait extends BasicControllerTrait
with UseComponentTrait with BasicBindingControllerTrait
with AbstractBindingControllerTrait {
// -------------------------------------------------------------------------
// Implementation of the BindingController interface
// -------------------------------------------------------------------------
override def unbindFc( clientItfName: String ) = {
val itf = weaveableC.getFcInterface(clientItfName).asInstanceOf[Interface]
val it = itf.getFcItfType().asInstanceOf[InterfaceType]
if( it.isFcCollectionItf ) {
fcBindings.remove(clientItfName)
}
else {
super.unbindFc( clientItfName )
}
}
}
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2011-2013 Inria, Univ. Lille 1
* Copyright (C) 2013 Inria, Univ. Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -35,12 +35,13 @@ import org.ow2.frascati.tinfi.control.content.UseSCAContentControllerTrait
import org.objectweb.fractal.julia.control.binding.AbstractBindingControllerTrait
/**
* Trait implementing the functionalities of the {@link BindingController}.
* This trait manages the references hold by client interfaces in relation with
* the methods of the {@link BindingController} interface.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.4.5
* @since 1.4.6
*/
trait BasicBindingControllerTrait extends BasicControllerTrait
trait InterfaceBindingControllerTrait extends BasicControllerTrait
with UseComponentTrait with UseSCAContentControllerTrait
with AbstractBindingControllerTrait {
......@@ -48,43 +49,11 @@ with AbstractBindingControllerTrait {
// Implementation of the BindingController interface
// -------------------------------------------------------------------------
override def listFc : Array[String] = {
val itfs = weaveableC.getFcInterfaces
var size = 0
itfs.foreach( o => {
val itf = o.asInstanceOf[Interface]
val it = itf.getFcItfType.asInstanceOf[InterfaceType]
if( it.isFcClientItf ) {
size += 1
}
})
val names = new Array[String](size)
var i = 0
itfs.foreach( o => {
val itf = o.asInstanceOf[Interface]
val it = itf.getFcItfType.asInstanceOf[InterfaceType]
if( it.isFcClientItf ) {
names(i) = itf.getFcItfName
i += 1
}
})
return names
}
override def lookupFc( clientItfName: String ) : Object = {
val ci = weaveableC.getFcInterface(clientItfName).asInstanceOf[ComponentInterface]
// Skip client interceptor
val interceptor = ci.getFcItfImpl.asInstanceOf[Interceptor]
val dst = interceptor.getFcItfDelegate
return dst
}
override def bindFc( clientItfName: String, serverItf: Object ) = {
val ci = weaveableC.getFcInterface(clientItfName).asInstanceOf[ComponentInterface]
super.bindFc( clientItfName, serverItf )
val ci = weaveableC.getFcInterface(clientItfName).asInstanceOf[ComponentInterface]
// Skip client interceptor
val interceptor = ci.getFcItfImpl.asInstanceOf[Interceptor]
......@@ -98,7 +67,9 @@ with AbstractBindingControllerTrait {
override def unbindFc( clientItfName: String ) = {
val ci = weaveableC.getFcInterface(clientItfName).asInstanceOf[ComponentInterface]
super.unbindFc( clientItfName )
val ci = weaveableC.getFcInterface(clientItfName).asInstanceOf[ComponentInterface]
// Skip client interceptor
val interceptor = ci.getFcItfImpl.asInstanceOf[Interceptor]
......
......@@ -29,6 +29,8 @@ import org.objectweb.fractal.julia.control.binding.CheckBindingTrait
import org.objectweb.fractal.julia.control.binding.TypeBindingTrait
import org.objectweb.fractal.julia.control.binding.ContentBindingTrait
import org.objectweb.fractal.julia.control.binding.LifeCycleBindingTrait
import org.objectweb.fractal.julia.control.binding.BasicBindingControllerTrait
import org.objectweb.fractal.julia.control.binding.TypeBasicBindingTrait
/**
* Trait implementing the {@link BindingController} control interface for SCA
......@@ -38,5 +40,11 @@ import org.objectweb.fractal.julia.control.binding.LifeCycleBindingTrait
* @since 1.4.5
*/
trait SCABindingControllerTrait extends BasicControllerTrait
with BasicBindingControllerTrait with CheckBindingTrait // with TypeBindingTrait
// with ContentBindingTrait with LifeCycleBindingTrait with BindingControllerTrait
with BasicBindingControllerTrait
with TypeBasicBindingTrait
with CollectionInterfaceBindingControllerTrait
with InterfaceBindingControllerTrait
with CheckBindingTrait
with TypeBindingTrait
with ContentBindingTrait
with LifeCycleBindingTrait
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment