Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2012-03-13 21:11:03 +0000
committerRyan D. Brooks2012-03-13 21:11:03 +0000
commit89739af4349c8e0f38b13b6b6fc4c065c8c64161 (patch)
treea2654938fa1e5c064c04ddc646d58f492cf430f5 /plugins/org.eclipse.osee.console.admin
parent0566cdf4e5eec4c809eff010eee3d433a0f8cabd (diff)
downloadorg.eclipse.osee-89739af4349c8e0f38b13b6b6fc4c065c8c64161.tar.gz
org.eclipse.osee-89739af4349c8e0f38b13b6b6fc4c065c8c64161.tar.xz
org.eclipse.osee-89739af4349c8e0f38b13b6b6fc4c065c8c64161.zip
feature[ats_VVMH0]: Console admin improvements
Diffstat (limited to 'plugins/org.eclipse.osee.console.admin')
-rw-r--r--plugins/org.eclipse.osee.console.admin/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/AbstractConsoleCallable.java26
-rw-r--r--plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandDispatcher.java18
-rw-r--r--plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandProviderImpl.java17
4 files changed, 34 insertions, 28 deletions
diff --git a/plugins/org.eclipse.osee.console.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.console.admin/META-INF/MANIFEST.MF
index d9a55fd3994..36437f0af68 100644
--- a/plugins/org.eclipse.osee.console.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.console.admin/META-INF/MANIFEST.MF
@@ -14,3 +14,4 @@ Import-Package: org.eclipse.osee.event,
org.osgi.framework
Service-Component: OSGI-INF/*.xml
Export-Package: org.eclipse.osee.console.admin
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/AbstractConsoleCallable.java b/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/AbstractConsoleCallable.java
index 750b15c06e0..d190e19aa4b 100644
--- a/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/AbstractConsoleCallable.java
+++ b/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/AbstractConsoleCallable.java
@@ -11,41 +11,35 @@
package org.eclipse.osee.console.admin.internal;
import java.util.concurrent.Callable;
+import org.eclipse.osee.console.admin.Console;
+import org.eclipse.osee.console.admin.ConsoleParameters;
import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.logger.Log;
/**
* @author Roberto E. Escobar
*/
public abstract class AbstractConsoleCallable<T> extends CancellableCallable<T> {
- private final Log logger;
+ private final Console console;
+ private final ConsoleParameters params;
private Callable<?> innerWorker;
- public AbstractConsoleCallable(Log logger) {
+ public AbstractConsoleCallable(Console console, ConsoleParameters params) {
super();
- this.logger = logger;
- }
-
- protected Log getLogger() {
- return logger;
+ this.console = console;
+ this.params = params;
}
@Override
public final T call() throws Exception {
- long startTime = 0;
- if (logger.isTraceEnabled()) {
- startTime = System.currentTimeMillis();
- }
+ long startTime = System.currentTimeMillis();
T result;
try {
result = innerCall();
} finally {
- if (logger.isTraceEnabled()) {
- logger.trace("Console Command - [%s] completed in [%s]", getClass().getSimpleName(),
- Lib.getElapseString(startTime));
- }
+ console.writeln("Console Command - [%s] completed in [%s]", params.getRawString(),
+ Lib.getElapseString(startTime));
}
return result;
}
diff --git a/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandDispatcher.java b/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandDispatcher.java
index 0141ef95ba9..7e0e99a5b80 100644
--- a/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandDispatcher.java
+++ b/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandDispatcher.java
@@ -66,12 +66,24 @@ public class CommandDispatcher {
ConsoleCommand command = getCommandById(cmdId);
ConsoleAdminUtils.checkNotNull(command, "command", "Unable to find command for [%s]", cmdId);
-
- Callable<?> callable = command.createCallable(console, params);
+ Callable<?> callable = createCallable(command, console, params);
execute(cmdId, callable);
}
- private <T> void execute(final String cmdId, Callable<T> callable) throws Exception {
+ private Callable<?> createCallable(final ConsoleCommand command, final Console console, final ConsoleParameters params) {
+ Callable<?> wrapped = new AbstractConsoleCallable<Object>(console, params) {
+
+ @Override
+ protected Object innerCall() throws Exception {
+ Callable<?> callable = command.createCallable(console, params);
+ return callAndCheckForCancel(callable);
+ }
+
+ };
+ return wrapped;
+ }
+
+ private <T> void execute(final String cmdId, final Callable<T> callable) throws Exception {
final String guid = GUID.create();
Future<?> future = getExecutorAdmin().schedule(CONSOLE_EXECUTOR_ID, callable, new ExecutionCallback<T>() {
diff --git a/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandProviderImpl.java b/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandProviderImpl.java
index 6017aa1abc1..45da8e7322f 100644
--- a/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandProviderImpl.java
+++ b/plugins/org.eclipse.osee.console.admin/src/org/eclipse/osee/console/admin/internal/CommandProviderImpl.java
@@ -79,18 +79,19 @@ public class CommandProviderImpl implements CommandProvider {
@Override
public String getHelp() {
- StringBuilder help = new StringBuilder();
- addHeader(help, CONSOLE_HEADER);
- addSyntax(help);
- addSubCommandHeader(help);
+ StringBuilder buffer = new StringBuilder();
+ addHeader(buffer, CONSOLE_HEADER);
+ addSyntax(buffer);
+ addSubCommandHeader(buffer);
+ addHelp(buffer);
Collection<ConsoleCommand> commands = getDispatcher().getRegistered();
List<ConsoleCommand> sorted = ConsoleAdminUtils.sort(commands);
for (ConsoleCommand command : sorted) {
- addCommand(help, command);
+ addCommand(buffer, command);
}
- addHelp(help);
- return help.toString();
+
+ return buffer.toString();
}
private void addHeader(StringBuilder help, String header) {
@@ -121,8 +122,6 @@ public class CommandProviderImpl implements CommandProvider {
}
private void addHelp(StringBuilder help) {
- help.append("Help:");
- help.append(NEW_LINE);
help.append(TAB);
help.append("osee help [sub-command]");
help.append(NEW_LINE);

Back to the top