Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
frascati
frascati
Commits
82384e95
Commit
82384e95
authored
Mar 17, 2013
by
Lionel Seinturier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for the management of collection interfaces with the binding controller.
parent
11857bf1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
211 additions
and
42 deletions
+211
-42
tinfi/RELEASE_NOTES.txt
tinfi/RELEASE_NOTES.txt
+1
-0
tinfi/extension/osgi/opt/oo/src/main/java/org/ow2/frascati/tinfi/osgi/SCAOSGiPrimitive.java
...in/java/org/ow2/frascati/tinfi/osgi/SCAOSGiPrimitive.java
+8
-2
tinfi/mixins/src/main/java/org/ow2/frascati/tinfi/control/binding/CollectionInterfaceBindingControllerMixin.java
...ol/binding/CollectionInterfaceBindingControllerMixin.java
+73
-0
tinfi/mixins/src/main/java/org/ow2/frascati/tinfi/control/binding/InterfaceBindingControllerMixin.java
...infi/control/binding/InterfaceBindingControllerMixin.java
+100
-0
tinfi/module/opt-oo/src/main/java/org/ow2/frascati/tinfi/opt/oo/SCAPrimitive.java
...main/java/org/ow2/frascati/tinfi/opt/oo/SCAPrimitive.java
+8
-2
tinfi/module/opt-oo/src/main/java/org/ow2/frascati/tinfi/opt/oo/light/SCALightPrimitive.java
...rg/ow2/frascati/tinfi/opt/oo/light/SCALightPrimitive.java
+8
-2
tinfi/tests/fraclet/src/test/java/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
...a/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
+1
-1
tinfi/tests/oasis/src/test/java/org/objectweb/fractal/julia/conform/components/BindingControllerTestCase.java
...l/julia/conform/components/BindingControllerTestCase.java
+9
-32
tinfi/tests/oasis/src/test/java/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
...a/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
+2
-2
tinfi/tests/osoa/src/test/java/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
...a/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
+1
-1
No files found.
tinfi/RELEASE_NOTES.txt
View file @
82384e95
Tinfi 1.4.6
-----------
* bug fix for the implementation of the binding controller
* minor additional framework behavior when setting collection references
(requested by Philippe)
...
...
tinfi/extension/osgi/opt/oo/src/main/java/org/ow2/frascati/tinfi/osgi/SCAOSGiPrimitive.java
View file @
82384e95
...
...
@@ -33,9 +33,11 @@ import org.objectweb.fractal.julia.BasicComponentMixin;
import
org.objectweb.fractal.julia.BasicControllerMixin
;
import
org.objectweb.fractal.julia.TypeComponentMixin
;
import
org.objectweb.fractal.julia.UseComponentMixin
;
import
org.objectweb.fractal.julia.control.binding.BasicBindingControllerMixin
;
import
org.objectweb.fractal.julia.control.binding.CheckBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.ContentBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.TypeBasicBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.TypeBindingMixin
;
import
org.objectweb.fractal.julia.control.content.BasicSuperControllerMixin
;
import
org.objectweb.fractal.julia.control.content.SuperControllerNotifier
;
...
...
@@ -52,7 +54,8 @@ import org.objectweb.fractal.juliac.osgi.control.lifecycle.OSGiLifeCycleControll
import
org.objectweb.fractal.juliac.proxy.LifeCycleSourceCodeGenerator
;
import
org.ow2.frascati.tinfi.api.control.SCAIntentController
;
import
org.ow2.frascati.tinfi.api.control.SCAPropertyController
;
import
org.ow2.frascati.tinfi.control.binding.BasicBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.binding.CollectionInterfaceBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.binding.InterfaceBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.component.ComponentContextMixin
;
import
org.ow2.frascati.tinfi.control.content.UseSCAContentControllerMixin
;
import
org.ow2.frascati.tinfi.control.intent.LifeCycleIntentMixin
;
...
...
@@ -121,9 +124,12 @@ public class SCAOSGiPrimitive {
impl
=
"SCABindingControllerImpl"
,
mixins
={
BasicControllerMixin
.
class
,
BasicBindingControllerMixin
.
class
,
TypeBasicBindingMixin
.
class
,
CollectionInterfaceBindingControllerMixin
.
class
,
InterfaceBindingControllerMixin
.
class
,
UseSCAContentControllerMixin
.
class
,
UseComponentMixin
.
class
,
BasicBindingControllerMixin
.
class
,
CheckBindingMixin
.
class
,
TypeBindingMixin
.
class
,
UseSuperControllerMixin
.
class
,
...
...
tinfi/mixins/src/main/java/org/ow2/frascati/tinfi/control/binding/CollectionInterfaceBindingControllerMixin.java
0 → 100644
View file @
82384e95
/***
* 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
java.util.Map
;
import
org.objectweb.fractal.api.Component
;
import
org.objectweb.fractal.api.Interface
;
import
org.objectweb.fractal.api.NoSuchInterfaceException
;
import
org.objectweb.fractal.api.control.BindingController
;
import
org.objectweb.fractal.api.control.IllegalBindingException
;
import
org.objectweb.fractal.api.control.IllegalLifeCycleException
;
import
org.objectweb.fractal.api.type.InterfaceType
;
/**
* This mixin layer removes collection interface instances from the map of
* bindings.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.4.6
*/
public
abstract
class
CollectionInterfaceBindingControllerMixin
implements
BindingController
{
// -------------------------------------------------------------------------
// Implementation of the BindingController interface
// -------------------------------------------------------------------------
public
void
unbindFc
(
String
clientItfName
)
throws
NoSuchInterfaceException
,
IllegalBindingException
,
IllegalLifeCycleException
{
Interface
itf
=
(
Interface
)
_this_weaveableC
.
getFcInterface
(
clientItfName
);
InterfaceType
it
=
(
InterfaceType
)
itf
.
getFcItfType
();
if
(
it
.
isFcCollectionItf
()
)
{
_this_fcBindings
.
remove
(
clientItfName
);
}
else
{
_super_unbindFc
(
clientItfName
);
}
}
// -------------------------------------------------------------------------
// Fields and methods required by the mixin class in the base class
// -------------------------------------------------------------------------
private
Component
_this_weaveableC
;
private
Map
<
String
,
Object
>
_this_fcBindings
;
abstract
protected
void
_super_unbindFc
(
String
clientItfName
)
throws
NoSuchInterfaceException
,
IllegalBindingException
,
IllegalLifeCycleException
;
}
tinfi/mixins/src/main/java/org/ow2/frascati/tinfi/control/binding/InterfaceBindingControllerMixin.java
0 → 100644
View file @
82384e95
/***
* 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.oasisopen.sca.ServiceReference
;
import
org.objectweb.fractal.api.Component
;
import
org.objectweb.fractal.api.NoSuchInterfaceException
;
import
org.objectweb.fractal.api.control.BindingController
;
import
org.objectweb.fractal.api.control.IllegalBindingException
;
import
org.objectweb.fractal.api.control.IllegalLifeCycleException
;
import
org.objectweb.fractal.julia.ComponentInterface
;
import
org.objectweb.fractal.julia.Interceptor
;
import
org.ow2.frascati.tinfi.TinfiComponentOutInterface
;
import
org.ow2.frascati.tinfi.control.content.SCAExtendedContentController
;
/**
* This mixin 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.6
*/
public
abstract
class
InterfaceBindingControllerMixin
implements
BindingController
{
// -------------------------------------------------------------------------
// Implementation of the BindingController interface
// -------------------------------------------------------------------------
public
void
bindFc
(
final
String
clientItfName
,
final
Object
serverItf
)
throws
NoSuchInterfaceException
,
IllegalBindingException
,
IllegalLifeCycleException
{
// Propagate to super layers
_super_bindFc
(
clientItfName
,
serverItf
);
ComponentInterface
ci
=
(
ComponentInterface
)
_this_weaveableC
.
getFcInterface
(
clientItfName
);
// Skip client interceptor
Interceptor
interceptor
=
(
Interceptor
)
ci
.
getFcItfImpl
();
interceptor
.
setFcItfDelegate
(
serverItf
);
// Inject reference into content instances
TinfiComponentOutInterface
<?>
tci
=
(
TinfiComponentOutInterface
<?>)
ci
;
ServiceReference
<?>
sr
=
tci
.
getServiceReference
();
_this_weaveableSCACC
.
setReferenceValue
(
clientItfName
,
sr
);
}
public
void
unbindFc
(
final
String
clientItfName
)
throws
NoSuchInterfaceException
,
IllegalBindingException
,
IllegalLifeCycleException
{
// Propagate to super layers
_super_unbindFc
(
clientItfName
);
ComponentInterface
ci
=
(
ComponentInterface
)
_this_weaveableC
.
getFcInterface
(
clientItfName
);
// Skip client interceptor
Interceptor
interceptor
=
(
Interceptor
)
ci
.
getFcItfImpl
();
interceptor
.
setFcItfDelegate
(
null
);
// Inject null into content instances
_this_weaveableSCACC
.
unsetReferenceValue
(
clientItfName
);
}
// -------------------------------------------------------------------------
// Fields and methods required by the mixin class in the base class
// -------------------------------------------------------------------------
private
Component
_this_weaveableC
;
private
SCAExtendedContentController
_this_weaveableSCACC
;
abstract
protected
void
_super_bindFc
(
String
clientItfName
,
Object
serverItf
)
throws
NoSuchInterfaceException
,
IllegalBindingException
,
IllegalLifeCycleException
;
abstract
protected
void
_super_unbindFc
(
String
clientItfName
)
throws
NoSuchInterfaceException
,
IllegalBindingException
,
IllegalLifeCycleException
;
}
tinfi/module/opt-oo/src/main/java/org/ow2/frascati/tinfi/opt/oo/SCAPrimitive.java
View file @
82384e95
...
...
@@ -33,9 +33,11 @@ import org.objectweb.fractal.julia.BasicComponentMixin;
import
org.objectweb.fractal.julia.BasicControllerMixin
;
import
org.objectweb.fractal.julia.TypeComponentMixin
;
import
org.objectweb.fractal.julia.UseComponentMixin
;
import
org.objectweb.fractal.julia.control.binding.BasicBindingControllerMixin
;
import
org.objectweb.fractal.julia.control.binding.CheckBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.ContentBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.TypeBasicBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.TypeBindingMixin
;
import
org.objectweb.fractal.julia.control.content.BasicSuperControllerMixin
;
import
org.objectweb.fractal.julia.control.content.SuperControllerNotifier
;
...
...
@@ -50,7 +52,8 @@ import org.objectweb.fractal.julia.control.name.UseNameControllerMixin;
import
org.objectweb.fractal.juliac.proxy.LifeCycleSourceCodeGenerator
;
import
org.ow2.frascati.tinfi.api.control.SCAIntentController
;
import
org.ow2.frascati.tinfi.api.control.SCAPropertyController
;
import
org.ow2.frascati.tinfi.control.binding.BasicBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.binding.CollectionInterfaceBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.binding.InterfaceBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.component.ComponentContextMixin
;
import
org.ow2.frascati.tinfi.control.content.LifeCycleSCAContentMixin
;
import
org.ow2.frascati.tinfi.control.content.RequestContextSCAContentMixin
;
...
...
@@ -103,9 +106,12 @@ public class SCAPrimitive {
impl
=
"SCABindingControllerImpl"
,
mixins
={
BasicControllerMixin
.
class
,
BasicBindingControllerMixin
.
class
,
TypeBasicBindingMixin
.
class
,
CollectionInterfaceBindingControllerMixin
.
class
,
InterfaceBindingControllerMixin
.
class
,
UseSCAContentControllerMixin
.
class
,
UseComponentMixin
.
class
,
BasicBindingControllerMixin
.
class
,
CheckBindingMixin
.
class
,
TypeBindingMixin
.
class
,
UseSuperControllerMixin
.
class
,
...
...
tinfi/module/opt-oo/src/main/java/org/ow2/frascati/tinfi/opt/oo/light/SCALightPrimitive.java
View file @
82384e95
...
...
@@ -33,9 +33,11 @@ import org.objectweb.fractal.julia.BasicComponentMixin;
import
org.objectweb.fractal.julia.BasicControllerMixin
;
import
org.objectweb.fractal.julia.TypeComponentMixin
;
import
org.objectweb.fractal.julia.UseComponentMixin
;
import
org.objectweb.fractal.julia.control.binding.BasicBindingControllerMixin
;
import
org.objectweb.fractal.julia.control.binding.CheckBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.ContentBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.TypeBasicBindingMixin
;
import
org.objectweb.fractal.julia.control.binding.TypeBindingMixin
;
import
org.objectweb.fractal.julia.control.content.BasicSuperControllerMixin
;
import
org.objectweb.fractal.julia.control.content.SuperControllerNotifier
;
...
...
@@ -50,7 +52,8 @@ import org.objectweb.fractal.julia.control.name.BasicNameControllerMixin;
import
org.objectweb.fractal.julia.control.name.UseNameControllerMixin
;
import
org.objectweb.fractal.juliac.proxy.LifeCycleSourceCodeGenerator
;
import
org.ow2.frascati.tinfi.api.control.SCAPropertyController
;
import
org.ow2.frascati.tinfi.control.binding.BasicBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.binding.CollectionInterfaceBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.binding.InterfaceBindingControllerMixin
;
import
org.ow2.frascati.tinfi.control.component.ComponentContextMixin
;
import
org.ow2.frascati.tinfi.control.content.LifeCycleSCAContentMixin
;
import
org.ow2.frascati.tinfi.control.content.RequestContextSCAContentMixin
;
...
...
@@ -99,9 +102,12 @@ public class SCALightPrimitive {
impl
=
"SCABindingControllerImpl"
,
mixins
={
BasicControllerMixin
.
class
,
BasicBindingControllerMixin
.
class
,
TypeBasicBindingMixin
.
class
,
CollectionInterfaceBindingControllerMixin
.
class
,
InterfaceBindingControllerMixin
.
class
,
UseSCAContentControllerMixin
.
class
,
UseComponentMixin
.
class
,
BasicBindingControllerMixin
.
class
,
CheckBindingMixin
.
class
,
TypeBindingMixin
.
class
,
UseSuperControllerMixin
.
class
,
...
...
tinfi/tests/fraclet/src/test/java/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
View file @
82384e95
...
...
@@ -192,7 +192,7 @@ public class SCAIntentControllerTestCase {
* invocations on interface methods.
*/
int
count
=
countItf
.
getCount
();
Assert
.
assertEquals
(
3
6
,
count
);
Assert
.
assertEquals
(
3
0
,
count
);
}
/**
...
...
tinfi/tests/oasis/src/test/java/org/objectweb/fractal/julia/conform/components/BindingControllerTestCase.java
View file @
82384e95
...
...
@@ -42,6 +42,14 @@ import org.objectweb.fractal.api.type.TypeFactory;
import
org.objectweb.fractal.util.Fractal
;
import
org.ow2.frascati.tinfi.TinfiDomain
;
/**
* This test originates from Julia but is reused here since the implemenation of
* the binding controller for Tinfi scaPrimitive components differs from the one
* of Julia primitive components.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.4.6
*/
public
class
BindingControllerTestCase
extends
org
.
objectweb
.
fractal
.
julia
.
conform
.
components
.
Test
{
...
...
@@ -54,10 +62,6 @@ extends org.objectweb.fractal.julia.conform.components.Test {
protected
boolean
isTemplate
;
protected
final
static
String
serverI
=
"server/"
+
PKG
+
".I/false,false,false"
;
protected
final
static
String
clientI
=
"client/"
+
PKG
+
".I/true,false,false"
;
protected
final
static
String
clients0I
=
"clients0/"
+
PKG
+
".I/true,false,true"
;
// -------------------------------------------------------------------------
// Constructor and setup
// -------------------------------------------------------------------------
...
...
@@ -113,43 +117,16 @@ extends org.objectweb.fractal.julia.conform.components.Test {
Assert
.
assertEquals
(
null
,
bc
.
lookupFc
(
"client"
));
}
//
@Test
@Test
public
void
testCollectionBindLookupUnbind
()
throws
Exception
{
/*
* TODO
*
* in tinfi-runtime-oo
* add a o.o.f.t.control.component.ComponentExt interface with a removeFc(Object) method
*
* in tinfi-mixins
* add a o.o.f.t.control.component.CollectionInterfaceComponentMixin layer
* implementing this method "in the vein of"
* org.objectweb.fractal.julia.TypeComponentMixin#getFcInterface(java.lang.String)
* but of course for removing collection interface instances
*
* in tinfi-opt-oo
* declare this extra layer in SCAPrimitive and in SCAComposite
*
* propage this change in tinfi-opt-comp-core and the tests in tinfi-tests-comp
*/
BindingController
bc
=
Fractal
.
getBindingController
(
c
);
bc
.
bindFc
(
"clients0"
,
d
.
getFcInterface
(
"server"
));
checkList
(
bc
,
new
String
[]
{
"client"
,
"clients0"
});
Assert
.
assertEquals
(
d
.
getFcInterface
(
"server"
),
bc
.
lookupFc
(
"clients0"
));
bc
.
unbindFc
(
"clients0"
);
/*
* From below, this differs from the original Julia test. The purpose is to
* illustrate the fact that although clients0 is unbound and is no longer
* returned with listFc, it is still present in the array returned by
* getFcInterfaces.
*/
Assert
.
assertEquals
(
null
,
bc
.
lookupFc
(
"clients0"
));
checkList
(
bc
,
new
String
[]
{
"client"
});
checkComponent
(
c
,
new
HashSet
<
String
>(
Arrays
.
asList
(
new
String
[]
{
COMP
,
BC
,
LC
,
SC
,
NC
,
serverI
,
clientI
,
clients0I
})));
}
protected
void
checkList
(
BindingController
bc
,
String
[]
expected
)
{
...
...
tinfi/tests/oasis/src/test/java/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
View file @
82384e95
...
...
@@ -221,11 +221,11 @@ public class SCAIntentControllerTestCase {
Fractal
.
getLifeCycleController
(
comp
).
startFc
();
/*
* 3
6
. That's the count. counter is incremented before and after
* 3
0
. That's the count. counter is incremented before and after
* invocations on interface methods.
*/
int
count
=
countItf
.
getCount
();
Assert
.
assertEquals
(
3
6
,
count
);
Assert
.
assertEquals
(
3
0
,
count
);
}
/**
...
...
tinfi/tests/osoa/src/test/java/org/ow2/frascati/tinfi/SCAIntentControllerTestCase.java
View file @
82384e95
...
...
@@ -192,7 +192,7 @@ public class SCAIntentControllerTestCase {
* invocations on interface methods.
*/
int
count
=
countItf
.
getCount
();
Assert
.
assertEquals
(
3
6
,
count
);
Assert
.
assertEquals
(
3
0
,
count
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment