changeset 1236:f8c480908c89

Move Launcher class to thermostat-launcher Reviewed-by: jerboaa Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-August/008077.html
author Omair Majid <omajid@redhat.com>
date Fri, 30 Aug 2013 11:26:02 -0400
parents 2b4427689a30
children bd62542c82f6
files agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/ServiceCommand.java agent/cli/src/test/java/com/redhat/thermostat/agent/cli/impl/ServiceCommandTest.java client/cli/pom.xml client/cli/src/main/java/com/redhat/thermostat/client/cli/internal/ShellCommand.java client/cli/src/test/java/com/redhat/thermostat/client/cli/internal/ShellCommandTest.java common/core/src/main/java/com/redhat/thermostat/common/Launcher.java common/core/src/main/java/com/redhat/thermostat/common/cli/Command.java launcher/src/main/java/com/redhat/thermostat/launcher/Launcher.java launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java main/src/test/java/com/redhat/thermostat/main/ThermostatTest.java vm-heap-analysis/client-core/pom.xml vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumper.java vm-heap-analysis/client-core/src/test/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumperTest.java
diffstat 16 files changed, 93 insertions(+), 83 deletions(-) [+]
line wrap: on
line diff
--- a/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/ServiceCommand.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/agent/cli/src/main/java/com/redhat/thermostat/agent/cli/impl/ServiceCommand.java	Fri Aug 30 11:26:02 2013 -0400
@@ -49,11 +49,11 @@
 import com.redhat.thermostat.agent.cli.impl.locale.LocaleResources;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.cli.AbstractCommand;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.tools.ApplicationState;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.shared.locale.Translate;
 
 /**
--- a/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/impl/ServiceCommandTest.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/agent/cli/src/test/java/com/redhat/thermostat/agent/cli/impl/ServiceCommandTest.java	Fri Aug 30 11:26:02 2013 -0400
@@ -62,10 +62,10 @@
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.ActionNotifier;
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.tools.ApplicationState;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.testutils.StubBundleContext;
 
 public class ServiceCommandTest {
--- a/client/cli/pom.xml	Wed Aug 28 13:26:28 2013 -0400
+++ b/client/cli/pom.xml	Fri Aug 30 11:26:02 2013 -0400
@@ -82,6 +82,11 @@
     </dependency>
     <dependency>
       <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-launcher</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-storage-core</artifactId>
       <version>${project.version}</version>
     </dependency>
--- a/client/cli/src/main/java/com/redhat/thermostat/client/cli/internal/ShellCommand.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/client/cli/src/main/java/com/redhat/thermostat/client/cli/internal/ShellCommand.java	Fri Aug 30 11:26:02 2013 -0400
@@ -52,13 +52,13 @@
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
 
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.common.cli.AbstractCommand;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.Console;
 import com.redhat.thermostat.common.utils.LoggingUtils;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.shared.config.Configuration;
 import com.redhat.thermostat.shared.config.InvalidConfigurationException;
 import com.redhat.thermostat.shared.locale.Translate;
--- a/client/cli/src/test/java/com/redhat/thermostat/client/cli/internal/ShellCommandTest.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/client/cli/src/test/java/com/redhat/thermostat/client/cli/internal/ShellCommandTest.java	Fri Aug 30 11:26:02 2013 -0400
@@ -57,12 +57,12 @@
 import org.osgi.framework.ServiceReference;
 
 import com.redhat.thermostat.client.cli.internal.ShellCommand.HistoryProvider;
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.common.cli.Arguments;
 import com.redhat.thermostat.common.cli.CommandContext;
 import com.redhat.thermostat.common.cli.CommandException;
 import com.redhat.thermostat.common.cli.SimpleArguments;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.test.TestCommandContextFactory;
 
 public class ShellCommandTest {
--- a/common/core/src/main/java/com/redhat/thermostat/common/Launcher.java	Wed Aug 28 13:26:28 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright 2012, 2013 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common;
-
-import java.util.Collection;
-
-import com.redhat.thermostat.annotations.Service;
-import com.redhat.thermostat.common.ActionListener;
-import com.redhat.thermostat.common.tools.ApplicationState;
-
-/**
- * Launcher is the main entry point for all Thermostat commands.
- */
-@Service
-public interface Launcher {
-
-    /**
-     * Invoked in order to start a command, either when Thermostat starts, or within
-     * the thermostat shell.  Equivalent to calling run(null, inShell).
-     * @param args the name of the command and any arguments to it
-     * @param inShell whether invoked from within the thermostat shell
-     */
-    void run(String[] args, boolean inShell);
-
-    /**
-     * Invoked in order to start a command, either when Thermostat starts, or within
-     * the thermostat shell.  If the command being run happens to be a AbstractStateNotifyingCommand,
-     * and the argument is non-null, the listeners will be added to the command for
-     * life cycle notifications.  Otherwise, the argument is ignored.
-     * @param args the name of the command and any arguments to it
-     * @param listeners the collection of listeners to be added to the command
-     * @param inShell whether invoked from within the thermostat shell
-     */
-    void run(String[] args, Collection<ActionListener<ApplicationState>> listeners, boolean inShell);
-
-}
-
--- a/common/core/src/main/java/com/redhat/thermostat/common/cli/Command.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/common/core/src/main/java/com/redhat/thermostat/common/cli/Command.java	Fri Aug 30 11:26:02 2013 -0400
@@ -63,7 +63,7 @@
 
     /**
      * Execute the command.  A CommandException may be thrown to indicate a failure
-     * condition; if so the {@link com.redhat.thermostat.launcher.Launcher} will
+     * condition; if so the {@link com.redhat.thermostat.launcher.launcher.Launcher} will
      * present the exception message to the user.
      */
     public void run(CommandContext ctx) throws CommandException;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/Launcher.java	Fri Aug 30 11:26:02 2013 -0400
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2012, 2013 Red Hat, Inc.
+ *
+ * This file is part of Thermostat.
+ *
+ * Thermostat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * Thermostat 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Thermostat; see the file COPYING.  If not see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Linking this code with other modules is making a combined work
+ * based on this code.  Thus, the terms and conditions of the GNU
+ * General Public License cover the whole combination.
+ *
+ * As a special exception, the copyright holders of this code give
+ * you permission to link this code with independent modules to
+ * produce an executable, regardless of the license terms of these
+ * independent modules, and to copy and distribute the resulting
+ * executable under terms of your choice, provided that you also
+ * meet, for each linked independent module, the terms and conditions
+ * of the license of that module.  An independent module is a module
+ * which is not derived from or based on this code.  If you modify
+ * this code, you may extend this exception to your version of the
+ * library, but you are not obligated to do so.  If you do not wish
+ * to do so, delete this exception statement from your version.
+ */
+
+package com.redhat.thermostat.launcher;
+
+import java.util.Collection;
+
+import com.redhat.thermostat.annotations.Service;
+import com.redhat.thermostat.common.ActionListener;
+import com.redhat.thermostat.common.tools.ApplicationState;
+
+/**
+ * Launcher is the main entry point for all Thermostat commands.
+ */
+@Service
+public interface Launcher {
+
+    /**
+     * Invoked in order to start a command, either when Thermostat starts, or within
+     * the thermostat shell.  Equivalent to calling run(null, inShell).
+     * @param args the name of the command and any arguments to it
+     * @param inShell whether invoked from within the thermostat shell
+     */
+    void run(String[] args, boolean inShell);
+
+    /**
+     * Invoked in order to start a command, either when Thermostat starts, or within
+     * the thermostat shell.  If the command being run happens to be a AbstractStateNotifyingCommand,
+     * and the argument is non-null, the listeners will be added to the command for
+     * life cycle notifications.  Otherwise, the argument is ignored.
+     * @param args the name of the command and any arguments to it
+     * @param listeners the collection of listeners to be added to the command
+     * @param inShell whether invoked from within the thermostat shell
+     */
+    void run(String[] args, Collection<ActionListener<ApplicationState>> listeners, boolean inShell);
+
+}
+
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/Activator.java	Fri Aug 30 11:26:02 2013 -0400
@@ -46,11 +46,11 @@
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
 import com.redhat.thermostat.common.ExitStatus;
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.cli.CommandContextFactory;
 import com.redhat.thermostat.common.cli.CommandRegistry;
 import com.redhat.thermostat.common.cli.CommandRegistryImpl;
 import com.redhat.thermostat.launcher.BundleManager;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.launcher.internal.CurrentEnvironment.CurrentEnvironmentChangeListener;
 import com.redhat.thermostat.shared.config.Configuration;
 import com.redhat.thermostat.utils.keyring.Keyring;
--- a/launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/launcher/src/main/java/com/redhat/thermostat/launcher/internal/LauncherImpl.java	Fri Aug 30 11:26:02 2013 -0400
@@ -53,7 +53,6 @@
 import com.redhat.thermostat.common.ActionNotifier;
 import com.redhat.thermostat.common.ApplicationService;
 import com.redhat.thermostat.common.ExitStatus;
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.common.cli.AbstractStateNotifyingCommand;
 import com.redhat.thermostat.common.cli.Arguments;
@@ -68,6 +67,7 @@
 import com.redhat.thermostat.common.tools.StorageAuthInfoGetter;
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.launcher.BundleManager;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.shared.config.InvalidConfigurationException;
 import com.redhat.thermostat.shared.locale.LocalizedString;
 import com.redhat.thermostat.shared.locale.Translate;
--- a/launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/launcher/src/test/java/com/redhat/thermostat/launcher/internal/ActivatorTest.java	Fri Aug 30 11:26:02 2013 -0400
@@ -72,11 +72,11 @@
 import org.powermock.modules.junit4.PowerMockRunner;
 
 import com.redhat.thermostat.common.ExitStatus;
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.MultipleServiceTracker;
 import com.redhat.thermostat.common.MultipleServiceTracker.Action;
 import com.redhat.thermostat.common.cli.Command;
 import com.redhat.thermostat.launcher.BundleManager;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.launcher.internal.Activator.RegisterLauncherCustomizer;
 import com.redhat.thermostat.shared.config.Configuration;
 import com.redhat.thermostat.testutils.StubBundleContext;
--- a/main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/main/src/main/java/com/redhat/thermostat/main/impl/FrameworkProvider.java	Fri Aug 30 11:26:02 2013 -0400
@@ -59,8 +59,8 @@
 import org.osgi.framework.launch.FrameworkFactory;
 import org.osgi.util.tracker.ServiceTracker;
 
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.launcher.BundleManager;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.shared.config.Configuration;
 import com.redhat.thermostat.shared.config.InvalidConfigurationException;
 
--- a/main/src/test/java/com/redhat/thermostat/main/ThermostatTest.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/main/src/test/java/com/redhat/thermostat/main/ThermostatTest.java	Fri Aug 30 11:26:02 2013 -0400
@@ -60,8 +60,8 @@
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
 
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.launcher.BundleManager;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.main.impl.FrameworkProvider;
 
 @RunWith(PowerMockRunner.class)
--- a/vm-heap-analysis/client-core/pom.xml	Wed Aug 28 13:26:28 2013 -0400
+++ b/vm-heap-analysis/client-core/pom.xml	Fri Aug 30 11:26:02 2013 -0400
@@ -121,6 +121,11 @@
     </dependency>
     <dependency>
       <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-launcher</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-vm-memory-common</artifactId>
       <version>${project.version}</version>
     </dependency>
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumper.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumper.java	Fri Aug 30 11:26:02 2013 -0400
@@ -40,8 +40,8 @@
 import org.osgi.framework.FrameworkUtil;
 import org.osgi.framework.ServiceReference;
 
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.cli.CommandException;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.storage.core.VmRef;
 
 public class HeapDumper {
--- a/vm-heap-analysis/client-core/src/test/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumperTest.java	Wed Aug 28 13:26:28 2013 -0400
+++ b/vm-heap-analysis/client-core/src/test/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumperTest.java	Fri Aug 30 11:26:02 2013 -0400
@@ -46,8 +46,8 @@
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
-import com.redhat.thermostat.common.Launcher;
 import com.redhat.thermostat.common.cli.CommandException;
+import com.redhat.thermostat.launcher.Launcher;
 import com.redhat.thermostat.storage.core.HostRef;
 import com.redhat.thermostat.storage.core.VmRef;
 import com.redhat.thermostat.testutils.StubBundleContext;