Commit 9381c645 authored by Philippe Merle's avatar Philippe Merle
Browse files

* Implemented the FraSCAti Explorer as an SCA composite.

  - removed .fractal files.
  - migrated ExplorerGUI from Fraclet to SCA annotations.
  - the explorer window title is reconfigurable.
* Split the explorer/core module into two modules: one for api, another for core.
* Cosmetic updates into pom files.
parent 44b842e4
FraSCAti Explorer 1.3
---------------------
* FraSCAti Explorer is implemented as an SCA composite.
* A lot of improvements that should be listed by Christophe.
FraSCAti Explorer 1.2
---------------------
* FraSCAti Script plugin improvement
......
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Explorer
* Copyright (c) 2008-2010 INRIA
*
* 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
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- ===================== -->
<!-- General Information -->
<!-- ===================== -->
<parent>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-explorer</artifactId>
<version>1.3-SNAPSHOT</version>
</parent>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-explorer-api</artifactId>
<packaging>jar</packaging>
<name>OW2 FraSCAti: Explorer API Module</name>
<inceptionYear>2008</inceptionYear>
<developers>
<developer>
<id>demarey</id>
<name>Christophe Demarey</name>
<organization>INRIA</organization>
<organizationUrl>http://www.inria.fr</organizationUrl>
<roles>
<role>Architect</role>
<role>Developer</role>
</roles>
</developer>
<developer>
<id>merle</id>
<name>Philippe Merle</name>
<email>Philippe.Merle@inria.fr</email>
<organization>INRIA</organization>
<organizationUrl>http://www.inria.fr</organizationUrl>
<roles>
<role>Architect</role>
<role>Developer</role>
</roles>
</developer>
</developers>
<!-- ========== -->
<!-- Properties -->
<!-- ========== -->
<!-- ======= -->
<!-- Build -->
<!-- ======= -->
<!-- ============= -->
<!-- Dependencies -->
<!-- ============= -->
<dependencies>
<!-- OW2 Fractal Explorer. -->
<dependency>
<groupId>org.objectweb.fractal.fractalexplorer</groupId>
<artifactId>fractal-explorer</artifactId>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swing-layout</artifactId>
<version>${org.jdesktop.version}</version>
</dependency>
</dependencies>
</project>
/***
* OW2 FraSCAti Explorer
* Copyright (C) 2009 INRIA, USTL
* Copyright (C) 2009-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
......
/***
* OW2 FraSCAti Explorer
* Copyright (C) 2009 INRIA, USTL
* Copyright (C) 2009-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
......@@ -79,7 +79,6 @@ public abstract class AbstractSelectionPanel<SelectionType> extends JPanel imple
// --------------------------------------------------------------------------
/**
* (non-Javadoc)
* @see org.objectweb.util.explorer.api.Panel#getPanel()
*/
public Object getPanel() {
......@@ -104,7 +103,6 @@ public abstract class AbstractSelectionPanel<SelectionType> extends JPanel imple
}
/**
* (non-Javadoc)
* @see org.objectweb.util.explorer.api.Panel#selected(org.objectweb.util.explorer.api.TreeView)
*/
@SuppressWarnings("unchecked")
......@@ -113,7 +111,6 @@ public abstract class AbstractSelectionPanel<SelectionType> extends JPanel imple
}
/**
* (non-Javadoc)
* @see org.objectweb.util.explorer.api.Panel#unselected(org.objectweb.util.explorer.api.TreeView)
*/
public void unselected(TreeView treeView) {
......
......@@ -58,6 +58,32 @@
<!-- Build -->
<!-- ======= -->
<build>
<plugins>
<!--
Compile the OW2 FraSCAti Explorer composite.
-->
<plugin>
<groupId>org.ow2.frascati.mojo</groupId>
<artifactId>frascati-compiler-plugin</artifactId>
<version>${frascati.version}</version>
<executions>
<execution>
<id>compile-composite</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<composite>org/ow2/frascati/FraSCAti</composite>
</configuration>
</plugin>
</plugins>
</build>
<!-- ============= -->
<!-- Dependencies -->
......@@ -65,11 +91,13 @@
<dependencies>
<!-- Fractal Explorer -->
<!-- OW2 FraSCAti Explorer API. -->
<dependency>
<groupId>org.objectweb.fractal.fractalexplorer</groupId>
<artifactId>fractal-explorer</artifactId>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-explorer-api</artifactId>
<version>${frascati.version}</version>
</dependency>
<dependency>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
......@@ -80,26 +108,21 @@
<artifactId>xercesImpl</artifactId>
</dependency>
<!-- Fractal ADL -->
<dependency>
<groupId>org.objectweb.fractal.fractaladl</groupId>
<artifactId>fractal-adl</artifactId>
</dependency>
<!-- FraSCAti -->
<!-- OW2 FraSCAti -->
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-runtime-factory</artifactId>
<version>${frascati.version}</version>
</dependency>
<!-- OW2 FraSCAti <frascati:implementation.fractal> -->
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-servlet-cxf</artifactId>
<artifactId>frascati-implementation-fractal</artifactId>
<version>${frascati.version}</version>
</dependency>
<!-- For files FrascatiDomainWrapper.java and .composite -->
<!-- OW2 FraSCAti Binding Factory. -->
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-binding-factory</artifactId>
......@@ -127,6 +150,13 @@
<version>${fractal-bf.version}</version>
</dependency>
<!-- OW2 FraSCAti Servlet CXF. -->
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-servlet-cxf</artifactId>
<version>${frascati.version}</version>
</dependency>
<!-- Truezip -->
<dependency>
<groupId>de.schlichtherle.io</groupId>
......@@ -139,11 +169,6 @@
<artifactId>appframework</artifactId>
<version>${org.jdesktop.version}</version>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swing-layout</artifactId>
<version>${org.jdesktop.version}</version>
</dependency>
<!-- for org.morbay.log.Log -->
<dependency>
......
<?xml version="1.0" encoding="UTF-8"?>
<spoon>
<spoonlet groupId="org.objectweb.fractal.fraclet.java"
artifactId="fractal-spoonlet" version="3.2.3" />
<spoonlet groupId="org.objectweb.fractal.fraclet.java"
artifactId="fractaladl-spoonlet" version="3.2.3" />
</spoon>
/***
* OW2 FraSCAti Explorer
* Copyright (C) 2008-2009 INRIA, USTL
* 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
......@@ -41,26 +41,28 @@ import javax.swing.JSplitPane;
import javax.swing.JToolBar;
import org.objectweb.fractal.bf.BindingFactory;
import org.objectweb.fractal.fraclet.annotations.Attribute;
import org.objectweb.fractal.fraclet.annotations.Interface;
import org.objectweb.fractal.fraclet.annotations.Requires;
import org.objectweb.util.explorer.api.Tree;
import org.objectweb.util.explorer.parser.api.ParserConfiguration;
import org.objectweb.util.explorer.swing.api.Explorer;
import org.objectweb.util.explorer.swing.api.StatusBar;
import org.objectweb.util.explorer.swing.api.ViewPanel;
import org.objectweb.util.explorer.swing.lib.DefaultTreePanel;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Property;
import org.ow2.frascati.assembly.factory.api.ClassLoaderManager;
import org.ow2.frascati.assembly.factory.api.CompositeManager;
import org.ow2.frascati.util.AbstractActiveComponent;
/**
* The main FraSCAti Framework Explorer GUI.
*
* @author Christophe Demarey
*/
@org.objectweb.fractal.fraclet.annotations.Component(provides=@Interface(name="r", signature=Runnable.class))
public class ExplorerGUI
implements Runnable
extends AbstractActiveComponent
{
/** FraSCAti Explorer configuration files standard name. */
public static final String EXPLORER_STD_CFG_FILES_NAME = "META-INF/FraSCAti-Explorer.xml";
......@@ -69,12 +71,6 @@ public class ExplorerGUI
// Internal state
// --------------------------------------------------------------------------
/**
* Logger.
*/
protected java.util.logging.Logger log = java.util.logging.Logger
.getLogger(this.getClass().getCanonicalName());
/**
* To store the ExplorerGUI singleton used by some static methods.
*/
......@@ -83,65 +79,66 @@ public class ExplorerGUI
/**
* The title of the frame.
*/
@Attribute
protected String frameTitle;
/**
* The explorer configuration files to use.
*/
@Attribute
@Property(name = "explorer-configuration-files")
protected String explorerConfigurationFiles;
/**
* The role used at the beginning.
*/
@Attribute
@Property(name = "initial-role")
protected String initialRole;
/**
* The configuration parser.
*/
@Requires(name="parser-configuration")
@Reference(name = "parser-configuration")
protected ParserConfiguration parser ;
/**
* The Explorer engine.
*/
@Requires(name="explorer")
@Reference(name = "explorer")
protected Explorer explorer;
/**
* The Explorer Tree.
*/
@Requires(name="tree")
@Reference(name = "tree")
protected Tree explorerTree;
/**
* The Explorer view panel.
*/
@Requires(name="view-panel")
@Reference(name = "view-panel")
protected ViewPanel viewPanel;
/**
* The Explorer Status bar.
*/
@Requires(name="status-bar")
@Reference(name = "status-bar")
protected StatusBar statusBar;
/**
* The SCA Domain composite Manager.
*/
@Requires(name="domain-composite-manager")
@Reference(name = "domain-composite-manager")
protected CompositeManager compositeManager;
/**
* The SCA Domain class loader Manager.
*/
@Requires(name="domain-classloader-manager")
@Reference(name = "domain-classloader-manager")
protected ClassLoaderManager classloaderManager;
/** The required binding factory. */
@Requires(name="binding-factory")
/**
* The required binding factory.
*/
@Reference(name = "binding-factory")
private BindingFactory bindingFactory;
/**
......@@ -171,7 +168,7 @@ public class ExplorerGUI
/**
* Run the GUI.
*/
public void run () {
public void run() {
//
// Configures the explorer engine.
//
......@@ -248,6 +245,18 @@ public class ExplorerGUI
// Public methods.
// --------------------------------------------------------------------------
/**
* Set the frame title.
*/
@Property(name = "frame-title")
public void setFrameTitle(String frameTitle)
{
this.frameTitle = frameTitle;
if(this.frame != null) {
this.frame.setTitle(this.frameTitle);
}
}
/**
* Get the ExplorerGUI singleton.
*/
......
/***
* OW2 FraSCAti explorer
* Copyright (C) 2009 INRIA, USTL
* OW2 FraSCAti Explorer
* Copyright (C) 2009-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
......@@ -20,24 +20,14 @@
*
* Author: Christophe Demarey
*
* Contributor(s):
* Contributor(s): Philippe Merle
*/
package org.ow2.frascati.explorer;
import java.util.Map;
import org.objectweb.fractal.adl.ContextMap;
import org.objectweb.fractal.adl.Factory;
import org.objectweb.fractal.adl.FactoryFactory;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.util.Fractal;
import org.ow2.frascati.assembly.factory.api.CompositeManager;
import org.ow2.frascati.assembly.factory.api.ManagerException;
import org.ow2.frascati.FraSCAti;
/**
* FraSCAti Explorer launcher.
* OW2 FraSCAti Explorer launcher.
* It allows to:
* <ul>
* <li>instanciate the FraSCAti runtime,</li>
......@@ -48,80 +38,6 @@ import org.ow2.frascati.assembly.factory.api.ManagerException;
* @author Christophe Demarey.
*/
public class FrascatiExplorerLauncher {
/** Default Explorer ADL file */
private static final String DEFAULT_EXPLORER_ADL = "org.ow2.frascati.explorer.FrascatiExplorer";
/** The explorer instance */
protected Component explorer;
/**
* Default Constructor.
*/
public FrascatiExplorerLauncher() {
String adlFile = System.getProperty("frascati.explorer.adl");
if (adlFile != null)
this.explorer = loadArchitecture(adlFile);
else
this.explorer = loadArchitecture(FrascatiExplorerLauncher.DEFAULT_EXPLORER_ADL);
}
/**
* Load the Explorer architecture with the help of the ADL factory.
*
* @return the Explorer composite.
*/
private static Component loadArchitecture(final String explorerAdl) {
Component explorer = null;
Factory factory = null;
Map<Object, Object> context = new ContextMap();
context.put("title", "FraSCAti Explorer");
// To be sure to load Explorer ADL into the current thread context class loader.
context.put("classloader", Thread.currentThread().getContextClassLoader());
try {
factory = FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND);
explorer = (Component) factory.newComponent(explorerAdl, context);
Fractal.getLifeCycleController(explorer).startFc();
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
return explorer;
}
/**
* Load, instanciate and start SCA composite in the runtime.
*
* @param composites - SCA composite file names.
*/
protected void loadComposites(String[] composites) {
CompositeManager compositeManager = null;
try {
compositeManager = (CompositeManager) explorer.getFcInterface("domain-composite-manager");
for (String composite : composites)
compositeManager.getComposite(composite);
} catch (ManagerException e1) {
e1.printStackTrace();
} catch (NoSuchInterfaceException e) {
e.printStackTrace();
System.exit(1);
}
}
/**
* Show the FraSCAti Explorer GUI.
*/
protected void showGui() {
try {
Runnable r = (Runnable) explorer.getFcInterface("r");
r.run();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* The bootstrap method.
......@@ -129,10 +45,19 @@ public class FrascatiExplorerLauncher {
* @param args - program arguments.
*/
public static void main(String[] args) {
FrascatiExplorerLauncher launcher = new FrascatiExplorerLauncher();
launcher.loadComposites(args);
launcher.showGui();
// The SCA composite for FraSCAti Explorer uses <frascati:implementation.fractal>
// so the FraSCAti Fractal bootstrap is required.
System.setProperty("org.ow2.frascati.bootstrap", "org.ow2.frascati.bootstrap.FraSCAtiFractal");
try {
FraSCAti frascati = FraSCAti.newFraSCAti();
for(String composite : args) {
frascati.getComposite(composite);
}
} catch(Exception e) {
throw new Error(e);
}
}
}
......@@ -43,10 +43,6 @@ public class FraSCAtiExplorerServlet extends FraSCAtiServlet {
*/
@Override
protected void launch(String[] composites) {
// Set Julia as the Fractal provider to use.
if(System.getProperties().getProperty("fractal.provider") == null) {
System.getProperties().setProperty("fractal.provider", "org.objectweb.fractal.julia.Julia");
}
// Launch FraSCAti Explorer.
FrascatiExplorerLauncher.main(composites);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- OW2 FraSCAti Explorer -->
<!-- Copyright (C) 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: Philippe Merle -->
<!-- -->
<!-- Contributor(s): -->
<!-- -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:explorer="org/ow2/frascati/explorer"
name="org.ow2.frascati.FraSCAti">
<component name="explorer">
<implementation.composite name="explorer:Explorer.composite"/>
<reference name="composite-manager" target="assembly-factory/composite-manager">