Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frascati
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
114
Issues
114
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frascati
frascati
Commits
92e263a6
Commit
92e263a6
authored
Jan 28, 2010
by
Christophe Demarey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explorer is now able to dynamically add intents.
parent
85ceca6b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
180 additions
and
20 deletions
+180
-20
explorer/core/src/main/java/org/ow2/frascati/explorer/action/AddIntentOnDropAction.java
...g/ow2/frascati/explorer/action/AddIntentOnDropAction.java
+166
-0
explorer/core/src/main/java/org/ow2/frascati/explorer/context/ComponentContext.java
...a/org/ow2/frascati/explorer/context/ComponentContext.java
+0
-11
explorer/core/src/main/java/org/ow2/frascati/explorer/context/ScaInterfaceContext.java
...rg/ow2/frascati/explorer/context/ScaInterfaceContext.java
+6
-3
explorer/core/src/main/resources/sca.xml
explorer/core/src/main/resources/sca.xml
+8
-6
No files found.
explorer/core/src/main/java/org/ow2/frascati/explorer/action/AddIntentOnDropAction.java
0 → 100644
View file @
92e263a6
/***
* OW2 FraSCAti Explorer
* Copyright (C) 2008-2010 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: Christophe Demarey
*
* Contributor(s):
*/
package
org.ow2.frascati.explorer.action
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.swing.JOptionPane
;
import
org.objectweb.fractal.api.Component
;
import
org.objectweb.fractal.api.Interface
;
import
org.objectweb.fractal.api.NoSuchInterfaceException
;
import
org.objectweb.fractal.explorer.context.ClientInterfaceWrapper
;
import
org.objectweb.fractal.util.Fractal
;
import
org.objectweb.util.explorer.api.DropAction
;
import
org.objectweb.util.explorer.api.DropTreeView
;
import
org.objectweb.util.explorer.api.MenuItem
;
import
org.ow2.frascati.tinfi.TinfiDomain
;
import
org.ow2.frascati.tinfi.control.intent.IntentHandler
;
import
org.ow2.frascati.tinfi.control.intent.SCABasicIntentController
;
/**
* This class provides the ability dynamically add an intent
* on an SCA service (or an SCA reference) via the "Add intent"
* Menu item {@link MenuItem}.
*
* @author Christophe Demarey
*/
public
class
AddIntentOnDropAction
implements
DropAction
{
// --------------------------------------------------------------------------
// Internal state
// --------------------------------------------------------------------------
public
static
final
Logger
log
=
Logger
.
getLogger
(
"org.ow2.frascati.explorer.action.AddIntentOnDropAction"
);
// --------------------------------------------------------------------------
// Internal methods
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Constructor
// --------------------------------------------------------------------------
/**
* The default constructor.
*/
public
AddIntentOnDropAction
()
{
}
// --------------------------------------------------------------------------
// Public methods.
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Implementation of the DropAction interface
// --------------------------------------------------------------------------
/**
* @see org.objectweb.util.explorer.api.DropAction#execute(DropTreeView)
*/
public
void
execute
(
DropTreeView
dropTreeView
)
throws
Exception
{
if
(
dropTreeView
!=
null
)
{
Component
intent
=
null
,
owner
=
null
;
Interface
itf
=
null
;
SCABasicIntentController
ic
=
null
;
String
intentName
=
null
;
try
{
intent
=
(
Component
)
dropTreeView
.
getDragSourceObject
();
}
catch
(
ClassCastException
cce
)
{
JOptionPane
.
showMessageDialog
(
null
,
"An intent must be an SCA component! source object is "
+
dropTreeView
.
getDragSourceObject
().
getClass
());
return
;
}
try
{
// SCA components
owner
=
(
Component
)
dropTreeView
.
getSelectedObject
();
}
catch
(
ClassCastException
cce
)
{
// SCA services
try
{
itf
=
(
Interface
)
dropTreeView
.
getSelectedObject
();
owner
=
itf
.
getFcItfOwner
();
}
catch
(
ClassCastException
cce2
)
{
// SCCA references
try
{
ClientInterfaceWrapper
wrapper
=
(
ClientInterfaceWrapper
)
dropTreeView
.
getSelectedObject
();
itf
=
wrapper
.
getItf
();
owner
=
itf
.
getFcItfOwner
();
}
catch
(
ClassCastException
cce3
)
{
JOptionPane
.
showMessageDialog
(
null
,
"An intent can only be applied on components, services and references!"
);
return
;
}
}
}
// Get intent controller
try
{
ic
=
(
SCABasicIntentController
)
owner
.
getFcInterface
(
SCABasicIntentController
.
NAME
);
}
catch
(
NoSuchInterfaceException
nsie
)
{
JOptionPane
.
showMessageDialog
(
null
,
"Cannot access to intent controller"
);
log
.
log
(
Level
.
SEVERE
,
"Cannot access to intent controller"
,
nsie
);
return
;
}
if
(
intent
!=
null
)
{
String
itfName
=
null
;
try
{
intentName
=
Fractal
.
getNameController
(
intent
).
getFcName
();
}
catch
(
NoSuchInterfaceException
nsie
)
{
log
.
log
(
Level
.
SEVERE
,
"Cannot find the Name Controller!"
,
nsie
);
}
try
{
// Stop intent component
Fractal
.
getLifeCycleController
(
intent
).
stopFc
();
// Stop owner component
Fractal
.
getLifeCycleController
(
owner
).
stopFc
();
// Get intent handler
IntentHandler
h
=
TinfiDomain
.
getService
(
intent
,
IntentHandler
.
class
,
"intent"
);
// Add intent
if
(
itf
!=
null
)
{
itfName
=
itf
.
getFcItfName
();
ic
.
addFcIntentHandler
(
h
,
itfName
);
}
else
{
ic
.
addFcIntentHandler
(
h
);
}
// Start intent component
Fractal
.
getLifeCycleController
(
intent
).
startFc
();
// Start owner component
Fractal
.
getLifeCycleController
(
owner
).
startFc
();
}
catch
(
Exception
e1
)
{
String
errorMsg
=
(
itf
!=
null
)
?
"interface "
+
itfName
:
"component"
;
JOptionPane
.
showMessageDialog
(
null
,
"Intent '"
+
intentName
+
"' cannot be added to "
+
errorMsg
);
log
.
log
(
Level
.
SEVERE
,
"Intent '"
+
intentName
+
"' cannot be added to "
+
errorMsg
,
e1
);
}
}
}
}
}
explorer/core/src/main/java/org/ow2/frascati/explorer/context/ComponentContext.java
View file @
92e263a6
...
...
@@ -125,17 +125,6 @@ public class ComponentContext
e
.
printStackTrace
();
}
// ** Display SCA intents
/*
try {
SCAIntentController intentCtl = (SCAIntentController) ci.getFcInterface(SCAIntentController.NAME);
if ( hasIntents(intentCtl) )
additionalEntries.add( new DefaultEntry("intents", intentCtl) );
} catch (NoSuchInterfaceException e) {
e.printStackTrace();
}*/
// ** Return entries
int
nbAdditionalEntries
=
additionalEntries
.
size
();
Entry
[]
defaultEntries
=
super
.
getEntries
(
object
);
...
...
explorer/core/src/main/java/org/ow2/frascati/explorer/context/ScaInterfaceContext.java
View file @
92e263a6
...
...
@@ -26,7 +26,9 @@ package org.ow2.frascati.explorer.context;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
org.objectweb.fractal.api.Component
;
import
org.objectweb.fractal.api.Interface
;
...
...
@@ -37,8 +39,6 @@ import org.objectweb.fractal.api.control.ContentController;
import
org.objectweb.fractal.bf.AbstractSkeleton
;
import
org.objectweb.fractal.bf.connectors.rest.RestSkeletonContentAttributes
;
import
org.objectweb.fractal.bf.connectors.rest.RestStubContentAttributes
;
import
org.objectweb.fractal.bf.connectors.rmi.RmiSkeletonAttributes
;
import
org.objectweb.fractal.bf.connectors.rmi.RmiStubAttributes
;
import
org.objectweb.fractal.bf.connectors.ws.WsSkeletonContentAttributes
;
import
org.objectweb.fractal.bf.connectors.ws.WsStubContentAttributes
;
import
org.objectweb.fractal.explorer.FcExplorer
;
...
...
@@ -83,7 +83,10 @@ public abstract class ScaInterfaceContext implements Context {
*/
protected
List
<
Entry
>
getIntentEntries
(
Component
owner
,
String
itfName
)
{
List
<
Entry
>
entries
=
new
ArrayList
<
Entry
>();
List
<
IntentHandler
>
intents
=
getIntents
(
owner
,
itfName
);
Set
<
IntentHandler
>
intents
=
new
HashSet
<
IntentHandler
>();
// We get 1 intent Handler / intent & method => group them to avoid duplicates
intents
.
addAll
(
getIntents
(
owner
,
itfName
)
);
if
(
!
intents
.
isEmpty
()
)
{
for
(
IntentHandler
intent
:
intents
)
{
...
...
explorer/core/src/main/resources/sca.xml
View file @
92e263a6
...
...
@@ -46,9 +46,6 @@
<code>
org.ow2.frascati.explorer.context.ComponentContext
</code>
</wrapper>
<menu>
<!-- <item label="FScript action">-->
<!-- <code>org.ow2.frascati.explorer.action.FscriptAction</code>-->
<!-- </item>-->
<item
label=
"Start"
>
<code>
org.objectweb.fractal.explorer.menu.StartComponentAction
</code>
<icon><icon-file
url=
"icons/Start.png"
/></icon>
...
...
@@ -63,6 +60,9 @@
<code>
org.objectweb.fractal.explorer.menu.FixComponentNameOnComponentAction
</code>
</item>
</menu>
<drop-action
label=
"Add intent"
>
<code>
org.ow2.frascati.explorer.action.AddIntentOnDropAction
</code>
</drop-action>
<panel>
<panel>
<code>
org.objectweb.fractal.explorer.panel.ComponentPanel
</code>
...
...
@@ -85,6 +85,9 @@
<info>
<code>
org.objectweb.fractal.explorer.info.InterfaceInfo
</code>
</info>
<drop-action
label=
"Add intent"
>
<code>
org.ow2.frascati.explorer.action.AddIntentOnDropAction
</code>
</drop-action>
</node>
<!-- ================================================================= -->
...
...
@@ -101,8 +104,8 @@
<code>
org.objectweb.fractal.explorer.menu.UnbindAction
</code>
</item>
</menu>
<drop-action
label=
"
Bind interface
"
>
<code>
org.o
bjectweb.fractal.explorer.menu.Bind
OnDropAction
</code>
<drop-action
label=
"
Add intent
"
>
<code>
org.o
w2.frascati.explorer.action.AddIntent
OnDropAction
</code>
</drop-action>
</node>
...
...
@@ -110,7 +113,6 @@
<wrapper>
<code>
org.ow2.frascati.explorer.context.ReferenceContext
</code>
</wrapper>
<!-- <icon><icon-file url="icons/scaService.png" /></icon> -->
</node>
<!-- ================================================================= -->
...
...
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