Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
frascati
frascati
Commits
d2a216dd
Commit
d2a216dd
authored
Mar 20, 2013
by
Philippe Merle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Readded this mixin as it is still used by EasyBPEL/EasyViper.
parent
443b5760
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
0 deletions
+126
-0
tinfi/mixins/src/main/java/org/ow2/frascati/tinfi/control/binding/BasicBindingControllerMixin.java
...ti/tinfi/control/binding/BasicBindingControllerMixin.java
+126
-0
No files found.
tinfi/mixins/src/main/java/org/ow2/frascati/tinfi/control/binding/BasicBindingControllerMixin.java
0 → 100644
View file @
d2a216dd
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2007-2011 INRIA, USTL
*
* 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.Interface
;
import
org.objectweb.fractal.api.NoSuchInterfaceException
;
import
org.objectweb.fractal.api.control.BindingController
;
import
org.objectweb.fractal.api.type.InterfaceType
;
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
;
/**
* Provides a basic implementation of the {@link BindingController} interface.
* This mixin manages the references hold by client interfaces.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
*/
public
abstract
class
BasicBindingControllerMixin
implements
BindingController
{
// -------------------------------------------------------------------------
// Implementation of the BindingController interface
// -------------------------------------------------------------------------
public
String
[]
listFc
()
{
Object
[]
itfs
=
_this_weaveableC
.
getFcInterfaces
();
int
size
=
0
;
for
(
Object
o
:
itfs
)
{
Interface
itf
=
(
Interface
)
o
;
InterfaceType
it
=
(
InterfaceType
)
itf
.
getFcItfType
();
if
(
it
.
isFcClientItf
()
)
{
size
++;
}
}
String
[]
names
=
new
String
[
size
];
int
i
=
0
;
for
(
Object
o
:
itfs
)
{
Interface
itf
=
(
Interface
)
o
;
InterfaceType
it
=
(
InterfaceType
)
itf
.
getFcItfType
();
if
(
it
.
isFcClientItf
()
)
{
names
[
i
]
=
itf
.
getFcItfName
();
i
++;
}
}
return
names
;
}
public
Object
lookupFc
(
final
String
clientItfName
)
throws
NoSuchInterfaceException
{
ComponentInterface
ci
=
(
ComponentInterface
)
_this_weaveableC
.
getFcInterface
(
clientItfName
);
// Skip client interceptor
Interceptor
interceptor
=
(
Interceptor
)
ci
.
getFcItfImpl
();
Object
dst
=
interceptor
.
getFcItfDelegate
();
return
dst
;
}
public
void
bindFc
(
final
String
clientItfName
,
final
Object
serverItf
)
throws
NoSuchInterfaceException
{
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
{
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
// -------------------------------------------------------------------------
public
Component
_this_weaveableC
;
public
SCAExtendedContentController
_this_weaveableSCACC
;
}
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