Commit 2f08ab06 authored by Philippe Merle's avatar Philippe Merle

* Improved the code quality according to Sonar's checking rules:

  - removed unused import statements.
  - put static final fields in uppercase.
  - added 'final' to not overridden methods.
  - moved from protected to private fields.
  - added brackets to if/else/do/for statements.
  - removed public to interfaces' methods.
* Replaced "USTL" by "University of Lille 1".
* Cosmetic updates.
parent ae22479e
/***
/**
* OW2 FraSCAti Explorer
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of 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,8 +35,9 @@ import org.objectweb.util.explorer.api.MenuItemTreeView;
*
* @author Philippe Merle
*/
public abstract class AbstractAlwaysEnabledMenuItem<T> implements MenuItem {
public abstract class AbstractAlwaysEnabledMenuItem<T>
implements MenuItem
{
// --------------------------------------------------------------------------
// Implementation of the MenuItem interface
// --------------------------------------------------------------------------
......@@ -44,7 +45,8 @@ public abstract class AbstractAlwaysEnabledMenuItem<T> implements MenuItem {
/**
* @see org.objectweb.util.explorer.api.MenuItem#getStatus(org.objectweb.util.explorer.api.TreeView)
*/
public int getStatus (final TreeView treeView) {
public int getStatus(final TreeView treeView)
{
return MenuItem.ENABLED_STATUS;
}
......@@ -52,28 +54,33 @@ public abstract class AbstractAlwaysEnabledMenuItem<T> implements MenuItem {
* @see org.objectweb.util.explorer.api.MenuItem#actionPerformed(org.objectweb.util.explorer.api.MenuItemTreeView)
*/
@SuppressWarnings("unchecked")
public void actionPerformed (final MenuItemTreeView e) {
public final void actionPerformed(final MenuItemTreeView e)
{
// Obtains the selected object.
T selected = (T) e.getSelectedObject();
// Execute something on the selected object.
execute(selected, e);
}
// --------------------------------------------------------------------------
// Internal methods overriden by concrete subclasses.
// --------------------------------------------------------------------------
/**
* Execute something on the selected object.
*
* Can be override in sub-classes.
*/
protected void execute(T selected, final MenuItemTreeView e) {
execute(selected);
protected void execute(T selected, final MenuItemTreeView e)
{
execute(selected);
}
// --------------------------------------------------------------------------
// Abstract methods implemented into concrete subclasses.
// --------------------------------------------------------------------------
/**
* Execute something on the selected object.
*/
protected abstract void execute(T selected);
protected void execute(T selected)
{
}
}
/***
/**
* OW2 FraSCAti Explorer
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -29,10 +29,12 @@ package org.ow2.frascati.explorer.gui;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.objectweb.fractal.api.Interface;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.LifeCycleController;
import org.objectweb.fractal.util.Fractal;
import org.objectweb.util.explorer.api.Panel;
import org.objectweb.util.explorer.api.TreeView;
......@@ -42,8 +44,10 @@ import org.objectweb.util.explorer.api.TreeView;
* @author Philippe Merle
*/
@SuppressWarnings("serial")
public abstract class AbstractSelectionPanel<SelectionType> extends JPanel implements Panel {
public abstract class AbstractSelectionPanel<SelectionType>
extends JPanel
implements Panel
{
/**
* The selected instance.
*/
......@@ -56,7 +60,8 @@ public abstract class AbstractSelectionPanel<SelectionType> extends JPanel imple
/**
* Default constructor creates an empty white panel.
*/
public AbstractSelectionPanel () {
public AbstractSelectionPanel()
{
super();
setBackground(Color.white);
}
......@@ -70,7 +75,8 @@ public abstract class AbstractSelectionPanel<SelectionType> extends JPanel imple
*
* @return the current selected object.
*/
public SelectionType getSelection() {
public final SelectionType getSelection()
{
return selected;
}
......@@ -81,7 +87,8 @@ public abstract class AbstractSelectionPanel<SelectionType> extends JPanel imple
/**
* @see org.objectweb.util.explorer.api.Panel#getPanel()
*/
public Object getPanel() {
public final Object getPanel()
{
if(selected instanceof Interface) {
try {
LifeCycleController lcc = Fractal.getLifeCycleController(((Interface)selected).getFcItfOwner());
......@@ -106,14 +113,16 @@ public abstract class AbstractSelectionPanel<SelectionType> extends JPanel imple
* @see org.objectweb.util.explorer.api.Panel#selected(org.objectweb.util.explorer.api.TreeView)
*/
@SuppressWarnings("unchecked")
public void selected(TreeView treeView) {
public void selected(TreeView treeView)
{
selected = (SelectionType) treeView.getSelectedObject();
}
/**
* @see org.objectweb.util.explorer.api.Panel#unselected(org.objectweb.util.explorer.api.TreeView)
*/
public void unselected(TreeView treeView) {
public void unselected(TreeView treeView)
{
selected = null;
}
}
/**
* OW2 FraSCAti explorer
* Copyright (C) 2009 INRIA, USTL
* OW2 FraSCAti Explorer
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,10 +19,12 @@
* Contact: frascati@ow2.org
*
* Author: Romain Rouvoy.
*
* Contributor(s): Philippe Merle
*
*/
package org.objectweb.util.trace;
/**
* Specialization of the Java util trace mechanism to deal with
* the fractal explorer log mechanism.<BR>
......@@ -41,33 +43,33 @@ public interface Trace
*
* @param msg - debugging message to print
*/
public void debug(String msg) ;
void debug(String msg) ;
/**
* Displays a debug message
*
* @param msg - information message to print
*/
public void info(String msg) ;
void info(String msg) ;
/**
* Displays a debug message
*
* @param msg - warning message to print
*/
public void warn(String msg) ;
void warn(String msg) ;
/**
* Displays a debug message
*
* @param msg - error message to print
*/
public void error(String msg) ;
void error(String msg) ;
/**
* Displays a debug message
*
* @param msg - fatal message to print
*/
public void fatal(String msg) ;
void fatal(String msg) ;
}
......@@ -39,22 +39,30 @@ import java.util.logging.Logger;
*
* @author Christophe Demarey
*/
public class TraceSystem
public final class TraceSystem
{
/**
* Can not be instantiated.
*/
private TraceSystem()
{
}
/** prefix used to identify Launcher loggers */
protected static final String prefix = "org.ow2.frascati.explorer.trace";
private static final String PREFIX = "org.ow2.frascati.explorer.trace";
/** list of current logger instancied */
protected static Map<String,TraceTemplate> list_ = new HashMap<String,TraceTemplate>();
private static Map<String,TraceTemplate> list = new HashMap<String,TraceTemplate>();
/**
* Creates a new logger identified by logger value
*
* @param logger - the name of the logger
*/
protected static void create(String logger) {
list_.put(logger,
new TraceTemplate(Logger.getLogger(prefix+"."+logger)));
protected static void create(String logger)
{
list.put(logger,
new TraceTemplate(Logger.getLogger(PREFIX+"."+logger)));
}
/**
......@@ -62,10 +70,12 @@ public class TraceSystem
*
* @param id - the identifier of the logger
*/
public static Trace get(String id) {
if (!list_.containsKey(id))
public static Trace get(String id)
{
if (!list.containsKey(id)) {
create(id);
return (Trace) list_.get(id);
}
return (Trace) list.get(id);
}
// Added because EasyBPEL Explorer requires this method.
......
/***
/**
* OW2 FraSCAti Explorer
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -28,7 +28,6 @@ package org.objectweb.util.trace;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Specialization of the Java util trace mechanism to deal with
* the fractal explorer log mechanism.<BR>
......@@ -43,14 +42,15 @@ public class TraceTemplate
implements Trace
{
/** underlying Java logger reference*/
protected Logger logger = null;
private Logger logger = null;
/**
* Default Constructor.
*
* @param log Java logger to use.
*/
public TraceTemplate(Logger log) {
public TraceTemplate(Logger log)
{
setLogger(log);
}
......@@ -59,7 +59,8 @@ public class TraceTemplate
*
* @param log OW2 Monolog Logger.
*/
public TraceTemplate(org.objectweb.util.monolog.api.Logger log) {
public TraceTemplate(org.objectweb.util.monolog.api.Logger log)
{
// Not implemented but could be invoked by the OW2 Explorer Framework
// when Monolog is activated into the OW2 Explorer Framework.
}
......@@ -67,14 +68,16 @@ public class TraceTemplate
/**
* @return Returns the logger.
*/
public Logger getLogger() {
public final Logger getLogger()
{
return logger;
}
/**
* @param logger The logger to set.
*/
public void setLogger(Logger logger) {
public final void setLogger(Logger logger)
{
this.logger = logger;
}
......@@ -83,7 +86,8 @@ public class TraceTemplate
*
* @param msg debugging message to print.
*/
public void debug(String msg) {
public final void debug(String msg)
{
getLogger().log(Level.FINE, msg);
}
......@@ -92,7 +96,8 @@ public class TraceTemplate
*
* @param msg information message to print.
*/
public void info(String msg) {
public final void info(String msg)
{
getLogger().log(Level.INFO, msg);
}
......@@ -101,7 +106,8 @@ public class TraceTemplate
*
* @param msg warning message to print.
*/
public void warn(String msg) {
public final void warn(String msg)
{
getLogger().log(Level.WARNING, msg);
}
......@@ -110,7 +116,8 @@ public class TraceTemplate
*
* @param msg error message to print.
*/
public void error(String msg) {
public final void error(String msg)
{
getLogger().log(Level.SEVERE, msg);
}
......@@ -119,7 +126,8 @@ public class TraceTemplate
*
* @param msg fatal message to print.
*/
public void fatal(String msg) {
public final void fatal(String msg)
{
getLogger().log(Level.SEVERE, msg);
}
}
/***
/**
* OW2 FraSCAti Explorer
* Copyright (C) 2008-2010 INRIA, USTL
* Copyright (C) 2008-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -76,66 +76,66 @@ public class ExplorerGUI
/**
* To store the ExplorerGUI singleton used by some static methods.
*/
protected static ExplorerGUI singleton;
private static ExplorerGUI singleton;
/**
* The title of the frame.
*/
protected String frameTitle;
private String frameTitle;
/**
* The explorer configuration files to use.
*/
@Property(name = "explorer-configuration-files")
protected String explorerConfigurationFiles;
private String explorerConfigurationFiles;
/**
* The role used at the beginning.
*/
@Property(name = "initial-role")
protected String initialRole;
private String initialRole;
/**
* The configuration parser.
*/
@Reference(name = "parser-configuration")
protected ParserConfiguration parser ;
private ParserConfiguration parser ;
/**
* The Explorer engine.
*/
@Reference(name = "explorer")
protected Explorer explorer;
private Explorer explorer;
/**
* The Explorer Tree.
*/
@Reference(name = "tree")
protected Tree explorerTree;
private Tree explorerTree;
/**
* The Explorer view panel.
*/
@Reference(name = "view-panel")
protected ViewPanel viewPanel;
private ViewPanel viewPanel;
/**
* The Explorer Status bar.
*/
@Reference(name = "status-bar")
protected StatusBar statusBar;
private StatusBar statusBar;
/**
* The SCA Domain composite Manager.
*/
@Reference(name = "domain-composite-manager")
protected CompositeManager compositeManager;
private CompositeManager compositeManager;
/**
* The SCA Domain class loader Manager.
*/
@Reference(name = "domain-classloader-manager")
protected ClassLoaderManager classloaderManager;
private ClassLoaderManager classloaderManager;
/**
* The required binding factory.
......@@ -146,7 +146,7 @@ public class ExplorerGUI
/**
* The Explorer GUI frame.
*/
protected JFrame frame;
private JFrame frame;
// --------------------------------------------------------------------------
// Internal methods
......@@ -159,7 +159,8 @@ public class ExplorerGUI
/**
* The default constructor.
*/
public ExplorerGUI () {
public ExplorerGUI ()
{
ExplorerGUI.singleton = this;
}
......@@ -170,7 +171,8 @@ public class ExplorerGUI
/**
* Run the GUI.
*/
public void run() {
public final void run()
{
//
// Configures the explorer engine.
//
......@@ -250,7 +252,7 @@ public class ExplorerGUI
* Set the frame title.
*/
@Property(name = "frame-title")
public void setFrameTitle(String frameTitle)
public final void setFrameTitle(String frameTitle)
{
this.frameTitle = frameTitle;
if(this.frame != null) {
......@@ -261,21 +263,24 @@ public class ExplorerGUI
/**
* Get the ExplorerGUI singleton.
*/
public static ExplorerGUI getSingleton() {
public static ExplorerGUI getSingleton()
{
return singleton;
}
/**
* Get the classloaderManager interface.
*/
public ClassLoaderManager getClassLoaderManager() {
public final ClassLoaderManager getClassLoaderManager()
{
return classloaderManager;
}
/**
* Get the binding factory.
*/
public BindingFactory getBindingFactory() {
public final BindingFactory getBindingFactory()
{
return bindingFactory;
}
......@@ -284,9 +289,9 @@ public class ExplorerGUI
*
* @param cfgFile The path to the configuration file to add.
*/
public void addExplorerConfigurationFile(String cfgFile) {
public final void addExplorerConfigurationFile(String cfgFile)
{
parser.addPropertyFile(cfgFile);
parser.parse();
}
}
/***
/**
* OW2 FraSCAti Explorer
* Copyright (C) 2008-2010 INRIA, USTL
* Copyright (C) 2008-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -20,8 +20,8 @@
*
* Author: Christophe Demarey
*
* Contributor(s):
*
* Contributor(s): Philippe Merle
*
*/
package org.ow2.frascati.explorer;
......@@ -33,14 +33,16 @@ import org.objectweb.util.explorer.core.common.lib.ClassResolver;
/**
* Utility class used to set the explorer framework classloader.
*/
public class FrascatiExplorerClassResolver extends ClassResolver {
public class FrascatiExplorerClassResolver
extends ClassResolver
{
/**
* Set tthe explorer classloader to use.
*
* @param classLoader an URLClassLoader.
*/
public static void setClassLoader(ClassLoader classLoader) {
public static void setClassLoader(ClassLoader classLoader)
{
current_ = (URLClassLoader) classLoader;
}
}
/***
/**
* OW2 FraSCAti Explorer
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -21,6 +21,7 @@
* Author: Christophe Demarey
*
* Contributor(s): Philippe Merle
*
*/
package org.ow2.frascati.explorer;
......@@ -37,15 +38,22 @@ import org.ow2.frascati.FraSCAti;
*
* @author Christophe Demarey.
*/
public class FrascatiExplorerLauncher {
public final class FrascatiExplorerLauncher
{
/**
* Can not be instantiated.
*/
private FrascatiExplorerLauncher()
{
}
/**
* The bootstrap method.
*
* @param args - program arguments.
*/
public static void main(String[] args) {
public static void main(String[] args)
{
// 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");
......
/***
/**
* OW2 FraSCAti Explorer
* Copyright (C) 2008-2010 INRIA, USTL
* Copyright (C) 2008-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -20,7 +20,8 @@
*
* Author: Christophe Demarey
*
* Contributor(s):
* Contributor(s): Philippe Merle
*
*/
package org.ow2.frascati.explorer.action;
......@@ -39,7 +40,6 @@ import org.objectweb.fractal.api.control.LifeCycleController;
import org.objectweb.fractal.bf.BindingFactoryException;
import org.objectweb.fractal.bf.connectors.rmi.RmiRegistryCreationException;
import org.objectweb.fractal.util.Fractal;
import org.objectweb.util.explorer.api.MenuItem;
import org.objectweb.util.explorer.api.MenuItemTreeView;
import org.ow2.frascati.explorer.ExplorerGUI;
import org.ow2.frascati.explorer.gui.NewBindingForm;
......@@ -52,24 +52,26 @@ import org.ow2.frascati.tinfi.TinfiComponentOutInterface;
*
* @author Christophe Demarey
*/
public class AddBindingMenuItem extends AbstractAlwaysEnabledMenuItem<Object> {
public class AddBindingMenuItem
extends AbstractAlwaysEnabledMenuItem<Object>
{
// --------------------------------------------------------------------------
// Internal state
// --------------------------------------------------------------------------
public static final Logger log = Logger.getLogger("org.ow2.frascati.explorer.action.AddBindingMenuItem");
private static final Logger LOG = Logger.getLogger("org.ow2.frascati.explorer.action.AddBindingMenuItem");
/** Classloader constant for binding factory */
public static String CLASSLOADER = "classloader";
private static final String CLASSLOADER = "classloader";
/** The interface to add binding on. */
String itfName = null;
private String itfName = null;
/** the component owning the interface to add binding on. */
Component owner = null;
private Component owner = null;
/** Is the interface to bind an SCA reference? */
boolean isScaReference = false;
private boolean isScaReference = false;
// --------------------------------------------------------------------------
// Internal methods
......@@ -82,7 +84,9 @@ public class AddBindingMenuItem extends AbstractAlwaysEnabledMenuItem<Object> {
/**
* The default constructor.
*/
public AddBindingMenuItem () { }
public AddBindingMenuItem ()
{
}
// --------------------------------------------------------------------------
// Public methods.
......@@ -94,7 +98,8 @@ public class AddBindingMenuItem extends AbstractAlwaysEnabledMenuItem<Object> {
*
* @param hints A map with entries needed by the Binding Factory.
*/