Bug 541656: Remove dependencies on Eclipse Platform
- Adapt to added jcommons.status, jcommons.runtime, jcommons.rmi and
jcommons.ts
Change-Id: I3755d57f5b332aacb3ca2d5b64c110bd7c22255b
diff --git a/CHANGES.md b/CHANGES.md
index 2cc73e8..db2e0c7 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,7 +6,20 @@
* All bundles require the bundle `org.eclipse.statet.jcommons.util`.
- * Large parts of API provide nullable annotations. (Bug 539045)
+ * All bundles, except bundles of eclient, no longer depends on Eclipse Platform. This includes
+ that bundles of ecommons or an 'eruntime' bundle are no longer required.
+
+ This causes various changes in the method signatures of the API. New relevant packages are:
+ - `org.eclipse.statet.jcommons.status`
+ - `org.eclipse.statet.jcommons.runtime`
+ - `org.eclipse.statet.jcommons.rmi`
+
+ (Bug 541656)
+
+ * `ToolService` and `RToolService` no longer depends on Eclipse Platform and moved to
+ `org.eclipse.statet.jcommons.ts` respectively `org.eclipse.statet.rj.ts.core`.
+
+ * Large parts of the API provide nullable annotations. (Bug 539045)
* The new method `RService.findData` finds the first object with a specified name in environments
and returns a fully qualified object with the object itself and the environment where the object
diff --git a/core/org.eclipse.statet.rj.client/.classpath b/core/org.eclipse.statet.rj.client/.classpath
index 1515433..4ff64d1 100644
--- a/core/org.eclipse.statet.rj.client/.classpath
+++ b/core/org.eclipse.statet.rj.client/.classpath
@@ -12,6 +12,5 @@
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="srcRSetups"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/core/org.eclipse.statet.rj.client/META-INF/MANIFEST.MF b/core/org.eclipse.statet.rj.client/META-INF/MANIFEST.MF
index da0d59f..8a89291 100644
--- a/core/org.eclipse.statet.rj.client/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.statet.rj.client/META-INF/MANIFEST.MF
@@ -8,8 +8,6 @@
Require-Bundle: org.eclipse.statet.rj.data;bundle-version="[4.0.0,4.1.0)",
org.eclipse.statet.rj.server;bundle-version="[4.0.0,4.1.0)",
org.eclipse.statet.rj.services.core;bundle-version="[4.0.0,4.1.0)"
-Import-Package: org.osgi.framework;version="1.8.0",
- org.eclipse.core.runtime,
- org.eclipse.statet.jcommons.lang;version="4.0.0"
-Export-Package: org.eclipse.statet.rj.rsetups;version="4.0.0",
- org.eclipse.statet.rj.server.client
+Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.status;version="4.0.0"
+Export-Package: org.eclipse.statet.rj.server.client;version="4.0.0"
diff --git a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClient.java b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClient.java
index 93c8624..562ea2c 100644
--- a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClient.java
+++ b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClient.java
@@ -36,13 +36,16 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-
+import org.eclipse.statet.jcommons.lang.NonNull;
import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.InfoStatus;
+import org.eclipse.statet.jcommons.status.NullProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.status.Statuses;
+import org.eclipse.statet.jcommons.status.WarningStatus;
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.data.REnvironment;
@@ -104,7 +107,7 @@
public abstract class AbstractRJComClient implements ComHandler {
- public static final String RJ_CLIENT_ID= "org.eclipse.statet.rj.client";
+ public static final @NonNull String RJ_CLIENT_ID= "org.eclipse.statet.rj.client"; //$NON-NLS-1$
public static int[] version() {
return new int[] { 4, 0, 0 };
@@ -196,9 +199,11 @@
try {
runAsyncCtrl(CtrlCmdItem.REQUEST_HOT_MODE);
}
- catch (final CoreException e) {
- if (e.getStatus().getSeverity() != IStatus.CANCEL) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when requesting hot mode.", e));
+ catch (final StatusException e) {
+ if (e.getStatus().getSeverity() != Status.CANCEL) {
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when requesting hot mode.",
+ e ));
}
}
}
@@ -209,7 +214,7 @@
private RService rService;
private Object rHandle;
- private IProgressMonitor progressMonitor;
+ private ProgressMonitor progressMonitor;
private final RJIO mainIO= new RJIO();
private MainCmdItem mainC2SFirst;
@@ -281,7 +286,9 @@
initGraphicFactory();
}
catch (final Exception e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when initializing R client graphic factory.", e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when initializing R client graphic factory.",
+ e ));
}
if (this.graphicFactory != null) {
final Map<String, ? extends Object> additional= this.graphicFactory.getInitServerProperties();
@@ -291,7 +298,8 @@
}
else {
this.graphicFactory= new DummyFactory();
- log(new Status(IStatus.WARNING, RJ_CLIENT_ID, -1, "No R client graphic factory configured.", null));
+ log(new WarningStatus(RJ_CLIENT_ID,
+ "No R client graphic factory configured." ));
}
}
@@ -375,12 +383,14 @@
}
}
- public void setRjsProperties(final Map<String, ? extends Object> properties) throws CoreException {
+ public void setRjsProperties(final Map<String, ? extends Object> properties) throws StatusException {
try {
this.rjConsoleEngine.setProperties(properties);
}
catch (final RemoteException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_CLIENT_ID, "An error occurred when setting server properties.", e));
+ throw new StatusException(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when setting server properties.",
+ e ));
}
}
@@ -468,7 +478,9 @@
throw e;
}
catch (final Exception e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when exec RJ UI command '" + item.getDataText() + "'.", e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when exec RJ UI command '" + item.getDataText() + "'.",
+ e ));
if (item.waitForClient()) {
item.setAnswer(new RjsStatus(RjsStatus.ERROR, 0, "Client error processing current command."));
}
@@ -481,8 +493,9 @@
}
protected RList handleUICallback(final String commandId, final RList args,
- final IProgressMonitor monitor) throws Exception {
- throw new CoreException(new Status(IStatus.WARNING, RJ_CLIENT_ID, -1, "Unhandled RJ UI command '" + commandId + "'.", null));
+ final ProgressMonitor m) throws Exception {
+ throw new StatusException(new WarningStatus(RJ_CLIENT_ID,
+ String.format("Unhandled RJ UI command '%1$s'.", commandId) ));
}
@@ -651,7 +664,9 @@
throw e;
}
catch (final Throwable e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when processing graphic command.", e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when processing graphic command.",
+ e ));
if (requestId >= 0) {
addC2SCmd(new GDCmdItem.Answer(requestId, devId, new RjsStatus(RjsStatus.ERROR, 0)));
}
@@ -669,7 +684,9 @@
throw e;
}
catch (final Exception e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when processing control command answer.", e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when processing control command answer.",
+ e ));
}
}
@@ -682,7 +699,9 @@
throw e;
}
catch (final Exception e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when processing data command answer.", e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when processing data command answer.",
+ e ));
}
}
@@ -695,7 +714,9 @@
throw e;
}
catch (final Exception e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when processing graphic operation answer.", e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when processing graphic operation answer.",
+ e ));
}
}
@@ -714,7 +735,7 @@
this.dataRequestId[level]= ((((0xff) & item.getCmdType()) << 24)
| ((0xff & item.getOp()) << 16)
| ((0xff & this.randomId << 8))
- | ((0xff & ++this.dataRequestCounter)) );
+ | ((0xff & ++this.dataRequestCounter)) );
item.requestId= (((0xff & level) << 24) | (0xffffff & this.dataRequestId[level]));
return item;
}
@@ -763,11 +784,12 @@
}
- protected abstract void log(IStatus status);
+ protected abstract void log(final Status status);
- protected abstract void handleServerStatus(final RjsStatus serverStatus, final IProgressMonitor monitor) throws CoreException;
+ protected abstract void handleServerStatus(final RjsStatus serverStatus,
+ final ProgressMonitor m) throws StatusException;
- protected abstract void handleStatus(Status status, IProgressMonitor monitor);
+ protected abstract void handleStatus(final Status status, final ProgressMonitor m);
protected void scheduleConnectionCheck() {
}
@@ -809,7 +831,7 @@
// handler failed
}
}
- final IProgressMonitor monitor= this.progressMonitor;
+ final ProgressMonitor monitor= this.progressMonitor;
if (monitor != null) {
monitor.setCanceled(true);
}
@@ -817,55 +839,59 @@
runAsyncCtrl(CtrlCmdItem.REQUEST_CANCEL);
return true;
}
- catch (final CoreException e) {
- if (e.getStatus().getSeverity() != IStatus.CANCEL) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "An error occurred when trying to interrupt R.", e));
+ catch (final StatusException e) {
+ if (e.getStatus().getSeverity() != Status.CANCEL) {
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when trying to interrupt R.",
+ e ));
}
return false;
}
}
- public final void runAsyncCtrl(final int id) throws CoreException {
+ public final void runAsyncCtrl(final int id) throws StatusException {
final RjsStatus status= (RjsStatus) runAsync(new CtrlCmdItem(id));
if (status.getSeverity() != RjsStatus.OK) {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Executing CTRL command failed.", null));
+ throw new StatusException(Statuses.newStatus(status.getSeverity(), RJ_CLIENT_ID,
+ String.format("Executing CTRL command failed with code= 0x%1$08X.",
+ status.getCode() )));
}
}
- public final RjsComObject runAsync(final RjsComObject com) throws CoreException {
+ public final RjsComObject runAsync(final RjsComObject com) throws StatusException {
if (this.closed) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_CLIENT_ID, 0, this.closedMessage, null));
+ throw new StatusException(new ErrorStatus(RJ_CLIENT_ID, this.closedMessage));
}
try {
return this.rjConsoleEngine.runAsync(com);
}
catch (final Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_CLIENT_ID, 0, "Communication error.", e));
+ throw new StatusException(new ErrorStatus(RJ_CLIENT_ID, "Communication error.", e));
}
}
- public final void runMainLoopPing(final IProgressMonitor monitor) throws CoreException {
+ public final void runMainLoopPing(final ProgressMonitor m) throws StatusException {
try {
this.mainRunGC= false;
final RjsStatus status= (RjsStatus) this.rjConsoleEngine.runMainLoop(RjsPing.INSTANCE);
if (status.getSeverity() == RjsStatus.OK) {
return;
}
- handleServerStatus(status, monitor);
+ handleServerStatus(status, m);
}
catch (final ConnectException e) {
- handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_DISCONNECTED), monitor);
+ handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_DISCONNECTED), m);
}
catch (final Exception e) {
// no need to log here
- handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_LOST), monitor);
+ handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_LOST), m);
}
}
- public final void runMainLoop(RjsComObject sendCom, MainCmdItem sendItem, final IProgressMonitor monitor) throws CoreException {
+ public final void runMainLoop(RjsComObject sendCom, MainCmdItem sendItem,
+ final ProgressMonitor m) throws StatusException {
if (this.closed) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_CLIENT_ID, 0, this.closedMessage, null));
+ throw new StatusException(new ErrorStatus(RJ_CLIENT_ID, this.closedMessage));
}
final boolean loopReadCallbackIgnore= !this.consoleReadCallbackRequired;
final int loopDataLevelIgnore= this.dataLevelIgnore;
@@ -880,7 +906,7 @@
this.dataLevelIgnore= this.dataLevelRequest;
startHotMode();
}
- this.progressMonitor= monitor;
+ this.progressMonitor= m;
int ok= 0;
while (!this.closed) {
try {
@@ -913,8 +939,9 @@
runnables[i].run();
}
catch (final Exception e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, 0,
- "An error occurred when running a deferred command.", e ));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when running a deferred command.",
+ e ));
}
}
}
@@ -933,7 +960,7 @@
continue;
}
finally {
- this.progressMonitor= monitor;
+ this.progressMonitor= m;
this.hotModeState= 4;
this.consoleReadCallback.setAnswer(RjsStatus.OK_STATUS);
sendItem= this.consoleReadCallback;
@@ -957,7 +984,7 @@
continue; // validate again
}
finally {
- this.progressMonitor= monitor;
+ this.progressMonitor= m;
}
}
else {
@@ -968,31 +995,36 @@
}
case RjsComObject.T_STATUS:
ok= 0;
- processStatus((RjsStatus) receivedCom, monitor);
+ processStatus((RjsStatus) receivedCom, m);
sendCom= this.mainC2SList;
continue;
}
}
catch (final ConnectException e) {
- handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_DISCONNECTED), monitor);
+ handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_DISCONNECTED), m);
return;
}
catch (final RemoteException e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "Communication error detail. Send:\n"+sendCom, e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "Communication error detail. Send:\n" + sendCom,
+ e ));
if (!this.closed && runAsyncPing()) { // async to avoid server gc
if (this.consoleReadCallback == null && ok == 0) {
ok++;
- handleStatus(new Status(IStatus.ERROR, RJ_CLIENT_ID, "Communication error, see Eclipse log for detail."), monitor);
+ handleStatus(new ErrorStatus(RJ_CLIENT_ID,
+ "Communication error, see Eclipse log for detail." ),
+ m );
continue;
}
- throw new CoreException(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1, "Communication error.", e));
+ throw new StatusException(new ErrorStatus(RJ_CLIENT_ID,
+ "Communication error.", e ));
}
- handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_LOST), monitor);
+ handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_LOST), m);
return;
}
}
- handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_DISCONNECTED), monitor);
+ handleServerStatus(new RjsStatus(RjsStatus.INFO, Server.S_DISCONNECTED), m);
}
finally {
this.dataLevelIgnore= loopDataLevelIgnore;
@@ -1009,7 +1041,8 @@
this.mainC2SFirst= item;
// TODO
- log(new Status(IStatus.INFO, RJ_CLIENT_ID, "Multiple C2S items:\\" + this.mainC2SFirst.toString() + "\n" + this.mainC2SFirst.next.toString()));
+ log(new InfoStatus(RJ_CLIENT_ID,
+ "Multiple C2S items:\\" + this.mainC2SFirst.toString() + "\n" + this.mainC2SFirst.next.toString() ));
}
}
@@ -1019,10 +1052,10 @@
return item;
}
- private final void processStatus(final RjsStatus status, final IProgressMonitor monitor)
- throws CoreException {
+ private final void processStatus(final RjsStatus status, final ProgressMonitor m)
+ throws StatusException {
if ((status.getCode() & 0xffffff00) == 0) {
- handleServerStatus(status, monitor);
+ handleServerStatus(status, m);
return;
}
if (status.getSeverity() != RjsStatus.OK) {
@@ -1067,13 +1100,15 @@
this.consoleReadCallbackRequired= false;
try {
this.hotModeState= 1;
- runMainLoop(new CtrlCmdItem(CtrlCmdItem.REQUEST_HOT_MODE), null, new NullProgressMonitor());
+ runMainLoop(new CtrlCmdItem(CtrlCmdItem.REQUEST_HOT_MODE), null,
+ new NullProgressMonitor() );
return true;
}
catch (final Throwable e) {
this.hotModeState= 0;
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, 0,
- "An error occurred when running hot mode.", e ));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when running hot mode.",
+ e ));
}
finally {
this.consoleReadCallbackRequired= savedCallbackRequired;
@@ -1136,8 +1171,9 @@
this.graphicFactory.closeGraphic(this.graphics[devId]);
}
catch (final Exception e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1,
- "An error occurred when closing R graphic (Device " + (devId+1) + ").", e ));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when closing R graphic (Device " + (devId+1) + ").",
+ e ));
}
this.graphics[devId]= null;
}
@@ -1168,9 +1204,10 @@
this.consoleReadCallbackRequired= true;
}
- public final void answerConsole(final String input, final IProgressMonitor monitor) throws CoreException {
+ public final void answerConsole(final String input,
+ final ProgressMonitor m) throws StatusException {
this.consoleReadCallback.setAnswer(input);
- runMainLoop(null, this.consoleReadCallback, monitor);
+ runMainLoop(null, this.consoleReadCallback, m);
this.runFinishTask= false;
}
@@ -1207,8 +1244,9 @@
}
}
catch (final RemoteException e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID,
- "An error occured when loading data for RPlatform information.", e));
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occured when loading data for RPlatform information.",
+ e ));
}
}
return this.platformObj;
@@ -1232,23 +1270,17 @@
public final void finishTask(
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (!this.runFinishTask) {
return;
}
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new MainCtrlCmdItem(MainCtrlCmdItem.OP_FINISH_TASK,
- 0 )), monitor);
+ 0 )), m);
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
return;
}
@@ -1271,7 +1303,7 @@
}
public final void evalVoid(final String expression, final @Nullable RObject envir,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (expression == null) {
throw new NullPointerException("expression");
}
@@ -1281,16 +1313,10 @@
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.EVAL_EXPR_VOID,
- 0, expression, null, null, envir )), monitor);
+ 0, expression, null, null, envir )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
return;
}
@@ -1300,7 +1326,7 @@
}
public final void evalVoid(final String name, final RList args, final @Nullable RObject envir,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (name == null) {
throw new NullPointerException("name");
}
@@ -1313,16 +1339,10 @@
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.EVAL_FCALL_VOID,
- 0, name, args, null, envir )), monitor );
+ 0, name, args, null, envir )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
return;
}
@@ -1333,7 +1353,7 @@
public RObject evalData(final String expression, final @Nullable RObject envir,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (expression == null) {
throw new NullPointerException("expression");
}
@@ -1344,16 +1364,10 @@
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.EVAL_EXPR_DATA,
- options, checkedDepth, expression, null, null, envir, factoryId )), monitor);
+ options, checkedDepth, expression, null, null, envir, factoryId )), m);
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
return ((DataCmdItem) this.dataAnswer[level]).getData();
}
@@ -1364,7 +1378,7 @@
public RObject evalData(final String name, final RObject args, final @Nullable RObject envir,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (name == null) {
throw new NullPointerException("name");
}
@@ -1378,16 +1392,10 @@
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.EVAL_FCALL_DATA,
- options, checkedDepth, name, args, null, envir, factoryId )), monitor );
+ options, checkedDepth, name, args, null, envir, factoryId )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
return ((DataCmdItem) this.dataAnswer[level]).getData();
}
@@ -1398,23 +1406,17 @@
public final RObject evalData(final RReference reference,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
final byte checkedDepth= (depth < Byte.MAX_VALUE) ? (byte) depth : Byte.MAX_VALUE;
final int level= newDataLevel();
try {
final long handle= reference.getHandle();
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.RESOLVE_DATA,
- options, checkedDepth, Long.toString(handle), null, null, null, factoryId )), monitor );
+ options, checkedDepth, Long.toString(handle), null, null, null, factoryId )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
return ((DataCmdItem) this.dataAnswer[level]).getData();
}
@@ -1423,9 +1425,17 @@
}
}
+ private StatusException toStatusException(final RjsStatus status, final String message) {
+ return new StatusException((status.getSeverity() == RjsStatus.CANCEL) ?
+ Statuses.CANCEL_STATUS :
+ Statuses.newStatus(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
+ String.format(message, status.getMessage()),
+ null ));
+ }
+
public RObject evalData(final byte envType, final String name,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (name == null) {
throw new NullPointerException("name");
}
@@ -1446,17 +1456,11 @@
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(operation,
options, checkedDepth,
- name, null, null, null, factoryId )), monitor );
+ name, null, null, null, factoryId )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
return ((DataCmdItem) this.dataAnswer[level]).getData();
}
@@ -1466,7 +1470,7 @@
}
public final void assignData(final String expression, final RObject data, final @Nullable RObject envir,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (expression == null) {
throw new NullPointerException("expression");
}
@@ -1479,16 +1483,10 @@
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.ASSIGN_DATA,
- 0, null, data, expression, envir )), monitor );
+ 0, null, data, expression, envir )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Assignment failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Assignment failed: %1$s");
}
return;
}
@@ -1499,7 +1497,7 @@
public final void assignData(final String name, final RObject args, final String expression,
final @Nullable RObject envir,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (name == null) {
throw new NullPointerException("name");
}
@@ -1515,16 +1513,10 @@
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.ASSIGN_FCALL,
- 0, name, args, expression, envir )), monitor );
+ 0, name, args, expression, envir )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Assignment failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Assignment failed: %1$s");
}
return;
}
@@ -1535,7 +1527,7 @@
public RObject[] findData(final String symbol, final RObject env, final boolean inherits,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (symbol == null) {
throw new NullPointerException("symbol");
}
@@ -1544,16 +1536,10 @@
try {
runMainLoop(null, createDataRequestId(level, new DataCmdItem(DataCmdItem.FIND_DATA,
(inherits) ? (options | 0x1000) : options, checkedDepth,
- symbol, null, null, env, factoryId )), monitor );
+ symbol, null, null, env, factoryId )), m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Evaluation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Evaluation failed: %1$s");
}
final DataCmdItem dataItem= (DataCmdItem) this.dataAnswer[level];
return (dataItem.getRho() != null) ?
@@ -1566,7 +1552,8 @@
}
- public void downloadFile(final OutputStream out, final String fileName, final int options, final IProgressMonitor monitor) throws CoreException {
+ public void downloadFile(final OutputStream out, final String fileName, final int options,
+ final ProgressMonitor m) throws StatusException {
final BinExchange request= new BinExchange(out, fileName, this.rjConsoleEngine, options);
final BinExchange answer;
try {
@@ -1577,17 +1564,12 @@
}
if (answer == null || !answer.isOK()) {
final RjsStatus status= (answer != null) ? answer.getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Downloading file failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Downloading file failed: %1$s");
}
}
- public byte[] downloadFile(final String fileName, final int options, final IProgressMonitor monitor) throws CoreException {
+ public byte[] downloadFile(final String fileName, final int options,
+ final ProgressMonitor m) throws StatusException {
final BinExchange request= new BinExchange(fileName, this.rjConsoleEngine, options);
final BinExchange answer;
try {
@@ -1598,18 +1580,13 @@
}
if (answer == null || !answer.isOK()) {
final RjsStatus status= (answer != null) ? answer.getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Downloading file failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Downloading file failed: %1$s");
}
return answer.getBytes();
}
- public void uploadFile(final InputStream in, final long length, final String fileName, final int options, final IProgressMonitor monitor) throws CoreException {
+ public void uploadFile(final InputStream in, final long length, final String fileName, final int options,
+ final ProgressMonitor m) throws StatusException {
final BinExchange request= new BinExchange(in, length, fileName, this.rjConsoleEngine, options);
final BinExchange answer;
try {
@@ -1620,34 +1597,22 @@
}
if (answer == null || !answer.isOK()) {
final RjsStatus status= (answer != null) ? answer.getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Uploading file failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Uploading file failed: %1$s");
}
}
public Object execSyncDbgOp(final byte dbgOp, final RJIOExternalizable request,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.dbgOpRequest) {
throw new IllegalStateException();
}
this.dbgOpRequest= true;
try {
- runMainLoop(null, new DbgCmdItem(dbgOp, 0, request), monitor);
+ runMainLoop(null, new DbgCmdItem(dbgOp, 0, request), m);
if (this.dbgOpAnswer == null || !this.dbgOpAnswer.isOK()) {
final RjsStatus status= (this.dbgOpAnswer != null) ? this.dbgOpAnswer.getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Dbg operation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Dbg operation failed: %1$s");
}
{ final Object data= this.dbgOpAnswer.getData();
if (data instanceof CtrlReport) {
@@ -1666,7 +1631,7 @@
}
public void execAsyncDbgOp(final byte op, final RJIOExternalizable request)
- throws CoreException {
+ throws StatusException {
execAsync(new Runnable() {
@Override
public void run() {
@@ -1674,9 +1639,10 @@
runAsync(new DbgCmdItem(op, 0, request));
// in future check returned status if required
}
- catch (final CoreException e) {
- log(new Status(IStatus.ERROR, RJ_CLIENT_ID, -1,
- "An error occurred when executing background dbg operation.", e));
+ catch (final StatusException e) {
+ log(new ErrorStatus(RJ_CLIENT_ID,
+ "An error occurred when executing background dbg operation.",
+ e ));
}
}
});
@@ -1697,20 +1663,14 @@
}
public Object execSyncGraphicOp(final int devId, final byte op,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new GraOpCmdItem(devId, op)),
- monitor );
+ m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Graphics operation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "Graphics operation failed: %1$s");
}
return ((GraOpCmdItem) this.dataAnswer[level]).getData();
}
@@ -1720,20 +1680,14 @@
}
public Object execSyncGraphicOp(final int devId, final byte op, final RJIOExternalizable data,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
final int level= newDataLevel();
try {
runMainLoop(null, createDataRequestId(level, new GraOpCmdItem(devId, op, data)),
- monitor );
+ m );
if (this.dataAnswer[level] == null || !this.dataAnswer[level].isOK()) {
final RjsStatus status= (this.dataAnswer[level] != null) ? this.dataAnswer[level].getStatus() : MISSING_ANSWER_STATUS;
- if (status.getSeverity() == RjsStatus.CANCEL) {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- else {
- throw new CoreException(new Status(status.getSeverity(), RJ_CLIENT_ID, status.getCode(),
- "Graphics operation failed: " + status.getMessage(), null));
- }
+ throw toStatusException(status, "\"Graphics operation failed: %1$s");
}
return ((GraOpCmdItem) this.dataAnswer[level]).getData();
}
diff --git a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClientGraphicActions.java b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClientGraphicActions.java
index 17c6704..264b61a 100644
--- a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClientGraphicActions.java
+++ b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/AbstractRJComClientGraphicActions.java
@@ -14,8 +14,8 @@
package org.eclipse.statet.rj.server.client;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.server.gr.Coord;
import org.eclipse.statet.rj.server.gr.GraOp;
@@ -44,19 +44,19 @@
public void doResizeGraphic(final int devId,
- final IProgressMonitor monitor) throws CoreException {
- this.rjs.execSyncGraphicOp(devId, GraOp.OP_REQUEST_RESIZE, monitor);
+ final ProgressMonitor m) throws StatusException {
+ this.rjs.execSyncGraphicOp(devId, GraOp.OP_REQUEST_RESIZE, m);
}
public void doCloseGraphic(final int devId,
- final IProgressMonitor monitor) throws CoreException {
- this.rjs.execSyncGraphicOp(devId, GraOp.OP_CLOSE, monitor);
+ final ProgressMonitor m) throws StatusException {
+ this.rjs.execSyncGraphicOp(devId, GraOp.OP_CLOSE, m);
}
@Override
public void copy(final int devId, final String toDev, final String toDevFile, final String toDevArgs,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
final StringBuilder sb= new StringBuilder(64);
sb.append("rj.gd::.rj.copyGD(");
sb.append("devNr=").append((devId + 1)).append("L,");
@@ -69,12 +69,12 @@
sb.append(",");
}
sb.replace(sb.length()-1, sb.length(), ")");
- this.rjs.evalVoid(sb.toString(), null, monitor);
+ this.rjs.evalVoid(sb.toString(), null, m);
}
@Override
public double[] convertGraphic2User(final int devId, final double[] xy,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (xy == null) {
throw new NullPointerException("xy");
}
@@ -82,7 +82,7 @@
throw new IllegalArgumentException("length of xy");
}
final Coord coord= (Coord) this.rjs.execSyncGraphicOp(devId, GraOp.OP_CONVERT_DEV2USER,
- new Coord(xy[0], xy[1]), monitor );
+ new Coord(xy[0], xy[1]), m );
if (coord != null && !Double.isNaN(coord.getX()) && !Double.isNaN(coord.getY())) {
return new double[] { coord.getX(), coord.getY() };
}
@@ -91,7 +91,7 @@
@Override
public double[] convertUser2Graphic(final int devId, final double[] xy,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (xy == null) {
throw new NullPointerException("xy");
}
@@ -99,7 +99,7 @@
throw new IllegalArgumentException("length of xy");
}
final Coord coord= (Coord) this.rjs.execSyncGraphicOp(devId, GraOp.OP_CONVERT_USER2DEV,
- new Coord(xy[0], xy[1]), monitor );
+ new Coord(xy[0], xy[1]), m );
if (coord != null && !Double.isNaN(coord.getX()) && !Double.isNaN(coord.getY())) {
return new double[] { coord.getX(), coord.getY() };
}
diff --git a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/FunctionCallImpl.java b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/FunctionCallImpl.java
index b26e421..8b71d7d 100644
--- a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/FunctionCallImpl.java
+++ b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/FunctionCallImpl.java
@@ -17,11 +17,10 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.data.RList;
import org.eclipse.statet.rj.data.RObject;
@@ -167,7 +166,7 @@
}
- private RList prepareArgs(final IProgressMonitor monitor) throws CoreException {
+ private RList prepareArgs(final ProgressMonitor m) throws StatusException {
// TODO step by step upload for large objects
final String[] names= this.argNames.toArray(new @Nullable String[this.argNames.size()]);
final RObject[] values= this.argValues.toArray(new RObject[this.argValues.size()]);
@@ -176,42 +175,44 @@
}
@Override
- public void evalVoid(final IProgressMonitor monitor) throws CoreException {
- final RList args= prepareArgs(monitor);
- this.rjs.evalVoid(this.name, args, null, monitor);
+ public void evalVoid(final ProgressMonitor m) throws StatusException {
+ final RList args= prepareArgs(m);
+ this.rjs.evalVoid(this.name, args, null, m);
}
@Override
- public void evalVoid(final @Nullable RObject envir, final IProgressMonitor monitor) throws CoreException {
- final RList args= prepareArgs(monitor);
- this.rjs.evalVoid(this.name, args, envir, monitor);
+ public void evalVoid(final @Nullable RObject envir,
+ final ProgressMonitor m) throws StatusException {
+ final RList args= prepareArgs(m);
+ this.rjs.evalVoid(this.name, args, envir, m);
}
@Override
- public RObject evalData(final IProgressMonitor monitor) throws CoreException {
- final RList args= prepareArgs(monitor);
- return this.rjs.evalData(this.name, args, null, null, 0, RService.DEPTH_INFINITE, monitor);
+ public RObject evalData(final ProgressMonitor m) throws StatusException {
+ final RList args= prepareArgs(m);
+ return this.rjs.evalData(this.name, args, null, null, 0, RService.DEPTH_INFINITE, m);
}
@Override
public RObject evalData(final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
- final RList args= prepareArgs(monitor);
- return this.rjs.evalData(this.name, args, null, factoryId, options, depth, monitor);
+ final ProgressMonitor m) throws StatusException {
+ final RList args= prepareArgs(m);
+ return this.rjs.evalData(this.name, args, null, factoryId, options, depth, m);
}
@Override
public RObject evalData(final @Nullable RObject envir,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
- final RList args= prepareArgs(monitor);
- return this.rjs.evalData(this.name, args, envir, factoryId, options, depth, monitor);
+ final ProgressMonitor m) throws StatusException {
+ final RList args= prepareArgs(m);
+ return this.rjs.evalData(this.name, args, envir, factoryId, options, depth, m);
}
@Override
- public void evalAssign(final String target, final IProgressMonitor monitor) throws CoreException {
- final RList args= prepareArgs(monitor);
- this.rjs.assignData(this.name, args, target, null, monitor);
+ public void evalAssign(final String target,
+ final ProgressMonitor m) throws StatusException {
+ final RList args= prepareArgs(m);
+ this.rjs.assignData(this.name, args, target, null, m);
}
@Override
diff --git a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphic.java b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphic.java
index cbca266..311731b 100644
--- a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphic.java
+++ b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphic.java
@@ -14,7 +14,7 @@
package org.eclipse.statet.rj.server.client;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
import org.eclipse.statet.rj.graphic.core.RCircle;
import org.eclipse.statet.rj.graphic.core.RClipSetting;
@@ -177,6 +177,6 @@
byte[] capture(int width, int height);
- double[] runRLocator(RService r, IProgressMonitor monitor);
+ double[] runRLocator(RService r, ProgressMonitor m);
}
diff --git a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicActions.java b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicActions.java
index ecd7e59..4f60b80 100644
--- a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicActions.java
+++ b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicActions.java
@@ -14,9 +14,9 @@
package org.eclipse.statet.rj.server.client;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
/**
@@ -30,16 +30,18 @@
String getRLabel();
- IStatus resizeGraphic(int devId, Runnable beforeResize);
- IStatus closeGraphic(int devId);
+ Status resizeGraphic(final int devId, final Runnable beforeResize);
+
+ Status closeGraphic(final int devId);
- void copy(int devId, String toDev, String toDevFile, String toDevArgs,
- IProgressMonitor monitor) throws CoreException;
- double[] convertGraphic2User(int devId, double[] xy,
- IProgressMonitor monitor) throws CoreException;
- double[] convertUser2Graphic(int devId, double[] xy,
- IProgressMonitor monitor) throws CoreException;
+ void copy(final int devId, final String toDev, final String toDevFile, final String toDevArgs,
+ final ProgressMonitor m) throws StatusException;
+
+ double[] convertGraphic2User(final int devId, final double[] xy,
+ final ProgressMonitor m) throws StatusException;
+ double[] convertUser2Graphic(final int devId, final double[] xy,
+ final ProgressMonitor m) throws StatusException;
}
diff --git a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicDummy.java b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicDummy.java
index e450813..f189d7e 100644
--- a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicDummy.java
+++ b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RClientGraphicDummy.java
@@ -14,7 +14,7 @@
package org.eclipse.statet.rj.server.client;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
import org.eclipse.statet.rj.services.RService;
@@ -140,7 +140,7 @@
@Override
- public double[] runRLocator(final RService r, final IProgressMonitor monitor) {
+ public double[] runRLocator(final RService r, final ProgressMonitor m) {
return null;
}
diff --git a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RGraphicCreatorImpl.java b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RGraphicCreatorImpl.java
index ca1f645..7be2905 100644
--- a/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RGraphicCreatorImpl.java
+++ b/core/org.eclipse.statet.rj.client/src/org/eclipse/statet/rj/server/client/RGraphicCreatorImpl.java
@@ -14,8 +14,8 @@
package org.eclipse.statet.rj.server.client;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.graphic.core.RGraphic;
import org.eclipse.statet.rj.services.FunctionCall;
@@ -61,16 +61,19 @@
}
@Override
- public RGraphic create(final String expression, final IProgressMonitor monitor) throws CoreException {
- return create(expression, null, monitor);
+ public RGraphic create(final String expression,
+ final ProgressMonitor m) throws StatusException {
+ return create(expression, null, m);
}
@Override
- public RGraphic create(final FunctionCall fcall, final IProgressMonitor monitor) throws CoreException {
- return create(null, fcall, monitor);
+ public RGraphic create(final FunctionCall fcall,
+ final ProgressMonitor m) throws StatusException {
+ return create(null, fcall, m);
}
- private RGraphic create(final String expression, final FunctionCall fcall, final IProgressMonitor monitor) throws CoreException {
+ private RGraphic create(final String expression, final FunctionCall fcall,
+ final ProgressMonitor m) throws StatusException {
final int savedOptions= this.rjs.getGraphicOptions();
int graphicOptions= this.options;
if ((this.options & RClientGraphicFactory.MANAGED_ON) == 0) {
@@ -83,18 +86,18 @@
final RClientGraphic graphic;
try {
if (this.width < 0) {
- this.service.evalVoid("rj.gd::rj.GD()", monitor);
+ this.service.evalVoid("rj.gd::rj.GD()", m);
}
else {
this.service.evalVoid("rj.gd::rj.GD(" +
"width= " + this.width + ", height= "+this.height+", size.unit= \"px\"" +
- ")", monitor );
+ ")", m );
}
if (expression != null) {
- this.service.evalData(expression, monitor);
+ this.service.evalData(expression, m);
}
else {
- fcall.evalVoid(monitor);
+ fcall.evalVoid(m);
}
graphic= this.rjs.getLastGraphic();
}
diff --git a/core/org.eclipse.statet.rj.server/META-INF/MANIFEST.MF b/core/org.eclipse.statet.rj.server/META-INF/MANIFEST.MF
index 3005956..0514163 100644
--- a/core/org.eclipse.statet.rj.server/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.statet.rj.server/META-INF/MANIFEST.MF
@@ -11,7 +11,8 @@
Import-Package: org.osgi.framework;resolution:=optional,
org.eclipse.core.runtime;resolution:=optional,
org.eclipse.statet.jcommons.collections;version="4.0.0",
- org.eclipse.statet.jcommons.lang;version="4.0.0"
+ org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.rmi;version="4.0.0"
Export-Package: org.eclipse.statet.rj,
org.eclipse.statet.rj.server,
org.eclipse.statet.rj.server.dbg,
diff --git a/core/org.eclipse.statet.rj.server/src/org/eclipse/statet/rj/server/srv/RMIAddress.java b/core/org.eclipse.statet.rj.server/src/org/eclipse/statet/rj/server/srv/RMIAddress.java
deleted file mode 100644
index a552af4..0000000
--- a/core/org.eclipse.statet.rj.server/src/org/eclipse/statet/rj/server/srv/RMIAddress.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*=============================================================================#
- # Copyright (c) 2009, 2018 Stephan Wahlbrink and others.
- #
- # This program and the accompanying materials are made available under the
- # terms of the Eclipse Public License 2.0 which is available at
- # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
- # which is available at https://www.apache.org/licenses/LICENSE-2.0.
- #
- # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
- #
- # Contributors:
- # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
- #=============================================================================*/
-
-package org.eclipse.statet.rj.server.srv;
-
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.UnknownHostException;
-import java.rmi.registry.Registry;
-
-
-/**
- * Address for RMI naming
- */
-class RMIAddress {
-
-
- public static final InetAddress LOOPBACK;
-
- public static void validate(final String address) throws MalformedURLException {
- try {
- new RMIAddress(address, false);
- }
- catch (final UnknownHostException e) {
- }
- }
-
-
- private static String checkChars(final String s) throws MalformedURLException {
- for (int i= 0; i < s.length(); i++) {
- final char c= s.charAt(i);
- if (c == '?' || c == '#' || c == '[' || c == ']' || c == '@'
- || c == '!' || c == '$' || c == '&' || c == '\'' || c == '(' || c == ')'
- || c == '*' || c == '+' || c == ',' || c == ';' || c == '='
- || c == '"' || c == '\\') {
- throw new MalformedURLException("Character '"+c+"' is not allowed.");
- }
- }
- return s;
- }
-
- private static int checkPort(final String port) throws MalformedURLException {
- final int portNum;
- try {
- portNum= (port != null) ? Integer.parseInt(port) : Registry.REGISTRY_PORT;
- }
- catch (final NumberFormatException e) {
- throw new MalformedURLException("Invalid port, " + e.getMessage());
- }
- return checkPort(portNum);
- }
-
- private static int checkPort(final int portNum) throws MalformedURLException {
- if (portNum < 0 || portNum > 65535) {
- throw new MalformedURLException("Invalid port, " + "Value must be in range 0-65535");
- }
- return portNum;
- }
-
- private static String build(final String host, final int portNum, final String name) {
- final StringBuilder sb= new StringBuilder("//"); //$NON-NLS-1$
- if (host != null) {
- sb.append(host);
- }
- sb.append(':');
- if (portNum >= 0) {
- sb.append(Integer.toString(portNum));
- }
- sb.append('/');
- if (name != null) {
- sb.append(name);
- }
- return sb.toString();
- }
-
-
- static {
- InetAddress loopbackAddress;
- try {
- loopbackAddress= InetAddress.getByAddress("localhost", new byte[] { 127, 0, 0, 1 }); //$NON-NLS-1$
- }
- catch (final UnknownHostException e) {
- loopbackAddress= null;
- e.printStackTrace();
- }
- LOOPBACK= loopbackAddress;
- }
-
-
- private final String host;
- private InetAddress hostAddress;
- private final String port;
- private final int portNum;
- private final boolean ssl;
- private final String path;
-
- private String address;
- private String ser;
-
-
- public RMIAddress(final String address) throws UnknownHostException, MalformedURLException {
- this(address, true);
- }
-
- public RMIAddress(final String host, final int portNum, final String name) throws UnknownHostException, MalformedURLException {
- this(build(host, portNum, name), true);
- }
-
- public RMIAddress(final InetAddress address, final int port, final String name)
- throws MalformedURLException {
- this(address.getHostAddress(), address, Integer.toString(port), checkPort(port), false,
- (name != null) ? checkChars(name) : "");
- }
-
- public RMIAddress(final InetAddress address, final int port, final boolean ssl, final String name)
- throws MalformedURLException {
- this(address.getHostAddress(), address, Integer.toString(port), checkPort(port), ssl,
- (name != null) ? checkChars(name) : "");
- }
-
- public RMIAddress(final RMIAddress registry, final String name) throws MalformedURLException {
- this(registry.host, registry.hostAddress, registry.port, registry.portNum, registry.ssl,
- (name != null) ? checkChars(name) : "");
- }
-
- private RMIAddress(String address, final boolean resolve) throws UnknownHostException, MalformedURLException {
- address= checkChars(address);
-
- if (address.startsWith("ssl:")) { //$NON-NLS-1$
- address= address.substring(4);
- this.ssl= true;
- }
- else {
- this.ssl= false;
- }
- if (address.startsWith("rmi:")) { //$NON-NLS-1$
- address= address.substring(4);
- }
- if (!address.startsWith("//")) { //$NON-NLS-1$
- address= "//"+address; //$NON-NLS-1$
- }
-
- final int idxPort= address.indexOf(':', 2);
- final int idxPath= address.indexOf('/', 2);
- if (idxPort > 0) {
- if (idxPath <= idxPort) {
- throw new IllegalArgumentException();
- }
- this.host= (2 < idxPort) ? address.substring(2, idxPort) : null;
- this.port= (idxPort+1 < idxPath) ? address.substring(idxPort+1, idxPath) : null;
- this.path= address.substring(idxPath+1);
- }
- else if (idxPath > 0){
- this.host= (2 < idxPath) ? address.substring(2, idxPath) : null;
- this.port= null;
- this.path= address.substring(idxPath+1);
- }
- else {
- this.host= null;
- this.port= null;
- this.path= address.substring(2);
- }
- try {
- this.portNum= checkPort(this.port);
- }
- catch (final NumberFormatException e) {
- throw new MalformedURLException("Invalid port, " + e.getLocalizedMessage());
- }
- if (resolve) {
- this.hostAddress= (this.host != null) ? InetAddress.getByName(this.host) : LOOPBACK;
- }
- }
-
- private RMIAddress(final String host, final InetAddress hostAddress, final String port,
- final int portNum, final boolean ssl, final String path) {
- this.host= host;
- this.hostAddress= hostAddress;
- this.port= port;
- this.portNum= portNum;
- this.ssl= ssl;
- this.path= path;
- }
-
-
- /**
- * @return the host as specified when creating the address
- */
- public String getHost() {
- return (this.host != null) ? this.host : this.hostAddress.getHostAddress();
- }
-
- public InetAddress getHostAddress() {
- return this.hostAddress;
- }
-
- public boolean isLocalHost() {
- if (this.hostAddress.isLoopbackAddress()) {
- return true;
- }
- try {
- final InetAddress localhost= InetAddress.getLocalHost();
- if (this.hostAddress.equals(localhost)) {
- return true;
- }
- }
- catch (final UnknownHostException e) {}
- catch (final ArrayIndexOutOfBoundsException e) { /* JVM bug */ }
-
- return false;
- }
-
- /**
- * @return the port
- */
- public String getPort() {
- return this.port;
- }
-
- public int getPortNum() {
- return this.portNum;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return this.path;
- }
-
- /**
- * Standard string presentation to use for rmi
- * @return
- */
- public String getAddress() {
- if (this.address == null) {
- final StringBuilder sb= new StringBuilder(32);
- sb.append("rmi://"); //$NON-NLS-1$
- if (this.host != null) {
- sb.append(this.host);
- }
- if (this.portNum != Registry.REGISTRY_PORT) {
- sb.append(':');
- sb.append(this.port);
- }
- sb.append('/');
- sb.append(this.path);
- this.address= sb.toString();
- }
- return this.address;
- }
-
- public RMIAddress getRegistryAddress() {
- return new RMIAddress(this.host, this.hostAddress, this.port, this.portNum, this.ssl, "");
- }
-
- /**
- *
- * @return if SSL is enabled
- *
- * @since 1.4
- */
- public boolean isSSL() {
- return this.ssl;
- }
-
-
- @Override
- public String toString() {
- if (this.ser == null) {
- final String address= getAddress();
- if (this.ssl) {
- this.ser= "ssl:" + address;
- }
- else {
- this.ser= address;
- }
- }
- return this.ser;
- }
-
- @Override
- public int hashCode() {
- return toString().hashCode();
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (!(obj instanceof RMIAddress)) {
- return false;
- }
- final RMIAddress other= (RMIAddress) obj;
- return (this.hostAddress.equals(other.hostAddress)
- && this.portNum == other.portNum
- && this.ssl == other.ssl
- && this.path.equals(other.path) );
- }
-
-}
diff --git a/core/org.eclipse.statet.rj.server/src/org/eclipse/statet/rj/server/srv/RMIServerControl.java b/core/org.eclipse.statet.rj.server/src/org/eclipse/statet/rj/server/srv/RMIServerControl.java
index 26a192d..1b95927 100644
--- a/core/org.eclipse.statet.rj.server/src/org/eclipse/statet/rj/server/srv/RMIServerControl.java
+++ b/core/org.eclipse.statet.rj.server/src/org/eclipse/statet/rj/server/srv/RMIServerControl.java
@@ -29,7 +29,6 @@
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.UnicastRemoteObject;
-import java.text.MessageFormat;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.LogRecord;
@@ -37,6 +36,8 @@
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
+
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.RjInvalidConfigurationException;
import org.eclipse.statet.rj.server.RjsComConfig;
@@ -135,7 +136,7 @@
if (this.rmiAddress.isSSL()) {
csf= new SslRMIClientSocketFactory();
}
- return LocateRegistry.getRegistry(this.rmiAddress.getHost(), this.rmiAddress.getPortNum(), csf);
+ return LocateRegistry.getRegistry(this.rmiAddress.getHost(), this.rmiAddress.getPort(), csf);
}
public String getName() {
@@ -332,7 +333,8 @@
record.setParameters(new Object[] { this.logPrefix, authType });
record.setThrown(e);
LOGGER.log(record);
- throw new RjException(MessageFormat.format("Init authentication method failed ''{0}''.", authType), e);
+ throw new RjException(String.format("Init authentication method failed '%1$s'.", authType),
+ e );
}
}
diff --git a/core/org.eclipse.statet.rj.services.core/.classpath b/core/org.eclipse.statet.rj.services.core/.classpath
index f6c1afc..63896b8 100644
--- a/core/org.eclipse.statet.rj.services.core/.classpath
+++ b/core/org.eclipse.statet.rj.services.core/.classpath
@@ -14,5 +14,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="srcREnv"/>
<classpathentry kind="src" path="srcGraphic"/>
+ <classpathentry kind="src" path="srcToolService"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/core/org.eclipse.statet.rj.services.core/META-INF/MANIFEST.MF b/core/org.eclipse.statet.rj.services.core/META-INF/MANIFEST.MF
index 3269e82..a2f2817 100644
--- a/core/org.eclipse.statet.rj.services.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.statet.rj.services.core/META-INF/MANIFEST.MF
@@ -6,12 +6,13 @@
Bundle-Name: StatET RJ - R Services API and Tools - Core
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.statet.rj.data;bundle-version="[4.0.0,4.1.0)";visibility:=reexport
-Import-Package: org.osgi.framework;version="1.8.0",
- org.eclipse.core.runtime,
- org.eclipse.statet.jcommons.lang;version="4.0.0"
+Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.status;version="4.0.0",
+ org.eclipse.statet.jcommons.ts.core;version="4.0.0";resolution:=optional
Export-Package: org.eclipse.statet.rj.graphic.core;version="4.0.0",
org.eclipse.statet.rj.graphic.core.util;version="4.0.0",
org.eclipse.statet.rj.renv.core;version="4.0.0",
org.eclipse.statet.rj.services;version="4.0.0",
org.eclipse.statet.rj.services.util;version="4.0.0",
- org.eclipse.statet.rj.services.util.dataaccess;version="4.0.0"
+ org.eclipse.statet.rj.services.util.dataaccess;version="4.0.0",
+ org.eclipse.statet.rj.ts.core;version="4.0.0"
diff --git a/core/org.eclipse.statet.rj.services.core/build.properties b/core/org.eclipse.statet.rj.services.core/build.properties
index fe1609f..dd228a9 100644
--- a/core/org.eclipse.statet.rj.services.core/build.properties
+++ b/core/org.eclipse.statet.rj.services.core/build.properties
@@ -1,6 +1,7 @@
source..= src/,\
srcREnv/,\
- srcGraphic/
+ srcGraphic/,\
+ srcToolService
output..= bin/
javacDefaultEncoding..= UTF-8
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/ToolFQRObject.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/BasicFQRObject.java
similarity index 74%
rename from eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/ToolFQRObject.java
rename to core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/BasicFQRObject.java
index 1b9d389..617b112 100644
--- a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/ToolFQRObject.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/BasicFQRObject.java
@@ -12,26 +12,23 @@
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
-package org.eclipse.statet.rj.eclient.core;
+package org.eclipse.statet.rj.services;
import static org.eclipse.statet.jcommons.lang.ObjectUtils.nonNullAssert;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-
import org.eclipse.statet.rj.data.REnvironment;
import org.eclipse.statet.rj.data.RLanguage;
import org.eclipse.statet.rj.data.RObject;
import org.eclipse.statet.rj.data.impl.RLanguageImpl;
-import org.eclipse.statet.rj.services.FQRObject;
@NonNullByDefault
-public class ToolFQRObject implements FQRObject {
+public class BasicFQRObject<THandle> implements FQRObject<THandle> {
- private final Tool tool;
+ private final THandle rHandle;
private final REnvironment env;
@@ -40,15 +37,15 @@
private final RObject object;
- public ToolFQRObject(final Tool tool, final REnvironment env, final RObject name, final RObject object) {
- this.tool= nonNullAssert(tool);
+ public BasicFQRObject(final THandle rHandle, final REnvironment env, final RObject name, final RObject object) {
+ this.rHandle= rHandle;
this.env= nonNullAssert(env);
this.name= nonNullAssert(name);
this.object= nonNullAssert(object);
}
- public ToolFQRObject(final Tool tool, final REnvironment env, final String name, final RObject object) {
- this.tool= nonNullAssert(tool);
+ public BasicFQRObject(final THandle rHandle, final REnvironment env, final String name, final RObject object) {
+ this.rHandle= rHandle;
this.env= nonNullAssert(env);
this.name= new RLanguageImpl(RLanguage.NAME, nonNullAssert(name), null);
this.object= nonNullAssert(object);
@@ -56,8 +53,8 @@
@Override
- public Tool getRHandle() {
- return this.tool;
+ public THandle getRHandle() {
+ return this.rHandle;
}
@Override
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/ToolFQRObjectRef.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/BasicFQRObjectRef.java
similarity index 82%
rename from eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/ToolFQRObjectRef.java
rename to core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/BasicFQRObjectRef.java
index 1842d98..f749ffd 100644
--- a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/ToolFQRObjectRef.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/BasicFQRObjectRef.java
@@ -12,20 +12,17 @@
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
-package org.eclipse.statet.rj.eclient.core;
+package org.eclipse.statet.rj.services;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-
import org.eclipse.statet.rj.data.RLanguage;
import org.eclipse.statet.rj.data.RObject;
import org.eclipse.statet.rj.data.RReference;
-import org.eclipse.statet.rj.services.FQRObjectRef;
@NonNullByDefault
-public class ToolFQRObjectRef implements FQRObjectRef {
+public class BasicFQRObjectRef<THandle> implements FQRObjectRef<THandle> {
private static boolean isValidEnvObject(final RObject env) {
@@ -55,17 +52,14 @@
}
- private final Tool tool;
+ private final THandle rHandle;
private final RObject env;
private final RObject name;
- public ToolFQRObjectRef(final Tool tool, final RObject env, final RObject name) {
- if (tool == null) {
- throw new NullPointerException("tool"); //$NON-NLS-1$
- }
+ public BasicFQRObjectRef(final THandle rHandle, final RObject env, final RObject name) {
if (env == null) {
throw new NullPointerException("env"); //$NON-NLS-1$
}
@@ -79,15 +73,15 @@
throw new IllegalArgumentException("name"); //$NON-NLS-1$
}
- this.tool= tool;
+ this.rHandle= rHandle;
this.env= env;
this.name= name;
}
@Override
- public Tool getRHandle() {
- return this.tool;
+ public THandle getRHandle() {
+ return this.rHandle;
}
@Override
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObject.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObject.java
index 4074e7d..4dd4abb 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObject.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObject.java
@@ -26,7 +26,7 @@
* @since 4.0
*/
@NonNullByDefault
-public interface FQRObject extends FQRObjectRef {
+public interface FQRObject<THandle> extends FQRObjectRef<THandle> {
@Override
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObjectRef.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObjectRef.java
index c7c4c1c..afdc715 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObjectRef.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FQRObjectRef.java
@@ -25,7 +25,7 @@
* @since 2.1
*/
@NonNullByDefault
-public interface FQRObjectRef {
+public interface FQRObjectRef<THandle> {
/**
@@ -33,7 +33,7 @@
*
* @return handle to R.
*/
- Object getRHandle();
+ THandle getRHandle();
/**
* The environment in R, specified by a call or reference.
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FunctionCall.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FunctionCall.java
index 30b70df..c8d54b9 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FunctionCall.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/FunctionCall.java
@@ -14,11 +14,10 @@
package org.eclipse.statet.rj.services;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.data.RObject;
import org.eclipse.statet.rj.data.RStore;
@@ -63,7 +62,7 @@
*
* @see #addChar(String, String) to add a string/character value directly
*/
- FunctionCall add(@Nullable String arg, String expression);
+ FunctionCall add(final @Nullable String arg, final String expression);
/**
* Adds a unnamed argument with the given R expression as value.
@@ -76,7 +75,7 @@
*
* @see #addChar(String) to add a string/character value directly
*/
- FunctionCall add(String expression);
+ FunctionCall add(final String expression);
/**
* Adds a argument with the given R data object as value.
@@ -85,7 +84,7 @@
* @param data an R data object
* @return a reference to this object
*/
- FunctionCall add(@Nullable String arg, RObject data);
+ FunctionCall add(final @Nullable String arg, final RObject data);
/**
* Adds an unnamed argument with the given R data object as value.
@@ -94,7 +93,7 @@
* @param data an R data object
* @return a reference to this object
*/
- FunctionCall add(RObject data);
+ FunctionCall add(final RObject data);
/**
@@ -107,7 +106,7 @@
* @param logical the value of the argument
* @return a reference to this object
*/
- FunctionCall addLogi(@Nullable String arg, boolean logical);
+ FunctionCall addLogi(final @Nullable String arg, final boolean logical);
/**
* Adds an unnamed argument with the given boolean/logical as value.
@@ -118,7 +117,7 @@
* @param logical the value of the argument
* @return a reference to this object
*/
- FunctionCall addLogi(boolean logical);
+ FunctionCall addLogi(final boolean logical);
/**
* Adds an argument with the given integer as value.
@@ -130,7 +129,7 @@
* @param integer the value of the argument
* @return a reference to this object
*/
- FunctionCall addInt(@Nullable String arg, int integer);
+ FunctionCall addInt(final @Nullable String arg, final int integer);
/**
* Adds an unnamed argument with the given integer as value.
@@ -141,7 +140,7 @@
* @param integer the value of the argument
* @return a reference to this object
*/
- FunctionCall addInt(int integer);
+ FunctionCall addInt(final int integer);
/**
* Adds an argument with the given double/numeric as value.
@@ -153,7 +152,7 @@
* @param numeric the value of the argument
* @return a reference to this object
*/
- FunctionCall addNum(@Nullable String arg, double numeric);
+ FunctionCall addNum(final @Nullable String arg, final double numeric);
/**
* Adds an unnamed argument with the given double/numeric as value.
@@ -165,7 +164,7 @@
* @param numeric the value of the argument
* @return a reference to this object
*/
- FunctionCall addNum(double numeric);
+ FunctionCall addNum(final double numeric);
/**
* Adds an argument with the given string/character as value.
@@ -177,7 +176,7 @@
* @param character the value of the argument
* @return a reference to this object
*/
- FunctionCall addCplx(@Nullable String arg, double real, double imaginary);
+ FunctionCall addCplx(final @Nullable String arg, final double real, final double imaginary);
/**
* Adds an unnamed argument with the given string/character as value.
@@ -188,7 +187,7 @@
* @param character the value of the argument
* @return a reference to this object
*/
- FunctionCall addCplx(double real, double imaginary);
+ FunctionCall addCplx(final double real, final double imaginary);
/**
* Adds an argument with the given string/character as value.
@@ -200,7 +199,7 @@
* @param character the value of the argument
* @return a reference to this object
*/
- FunctionCall addChar(@Nullable String arg, String character);
+ FunctionCall addChar(final @Nullable String arg, final String character);
/**
* Adds an unnamed argument with the given string/character as value.
@@ -211,7 +210,7 @@
* @param character the value of the argument
* @return a reference to this object
*/
- FunctionCall addChar(String character);
+ FunctionCall addChar(final String character);
/**
* Adds an argument with the given NULL as value.
@@ -222,7 +221,7 @@
* @param arg the name of the argument or <code>null</code> for unnamed
* @return a reference to this object
*/
- FunctionCall addNull(@Nullable String arg);
+ FunctionCall addNull(final @Nullable String arg);
/**
* Adds an unnamed argument with the given NULL as value.
@@ -241,11 +240,11 @@
*
* <p>The evaluation is performed in the global environment of R.</p>
*
- * @param monitor a progress monitor to catch cancellation and provide progress feedback.
- * @throws CoreException if the operation was canceled or failed; the status
+ * @param m a progress monitor to catch cancellation and provide progress feedback.
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- void evalVoid(IProgressMonitor monitor) throws CoreException;
+ void evalVoid(final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of this function call in R without returning a value.
@@ -255,31 +254,31 @@
*
* @param envir the environment where to perform the evaluation; specified by an reference
* or language object, or <code>null</code> for the global environment
- * @param monitor a progress monitor to catch cancellation and provide progress feedback.
- * @throws CoreException if the operation was canceled or failed; the status
+ * @param m a progress monitor to catch cancellation and provide progress feedback.
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*
* @since de.walware.rj.services 2.1
*/
- void evalVoid(@Nullable RObject envir,
- IProgressMonitor monitor) throws CoreException;
+ void evalVoid(final @Nullable RObject envir,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the this function call in R and returns its value as R data object.
* The method returns after the evaluation is finished.
*
- * <p>This is a short version of {@link #evalData(String, int, int, IProgressMonitor)}
+ * <p>This is a short version of {@link #evalData(String, int, int, ProgressMonitor)}
* sufficient for most purpose. The returned R data objects are created by the default factory
* with no limit in the object tree depth.</p>
*
* <p>The evaluation is performed in the global environment of R.</p>
*
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the evaluated value as R data object
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- RObject evalData(IProgressMonitor monitor) throws CoreException;
+ RObject evalData(final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the this function call in R and returns its value as R data object.
@@ -292,13 +291,13 @@
* @param factoryId the id of the factory to use when creating the RObject in this VM.
* @param options 0
* @param depth object tree depth for the created return value
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the evaluated value as R data object
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- RObject evalData(@Nullable String factoryId, int options, int depth,
- IProgressMonitor monitor) throws CoreException;
+ RObject evalData(final @Nullable String factoryId, final int options, final int depth,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the this function call in R and returns its value as R data object.
@@ -312,16 +311,16 @@
* @param factoryId the id of the factory to use when creating the RObject in this VM.
* @param options 0
* @param depth object tree depth for the created return value
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the evaluated value as R data object
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*
* @since de.walware.rj.services 2.1
*/
- RObject evalData(@Nullable RObject envir,
- @Nullable String factoryId, int options, int depth,
- IProgressMonitor monitor) throws CoreException;
+ RObject evalData(final @Nullable RObject envir,
+ final @Nullable String factoryId, final int options, final int depth,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the this function call in R and assign its return value to
@@ -335,13 +334,13 @@
* <p>The evaluation and assignment is performed in the global environment of R.</p>
*
* @param target a single valid expression to assign the result to
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
- * @throws CoreException if the operation was canceled or failed; the status
+ * @param m a progress monitor to catch cancellation and provide progress feedback
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*
* @since de.walware.rj.services 2.0
*/
- void evalAssign(String target,
- IProgressMonitor monitor) throws CoreException;
+ void evalAssign(final String target,
+ final ProgressMonitor m) throws StatusException;
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RGraphicCreator.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RGraphicCreator.java
index 8b1c4ef..4c805e5 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RGraphicCreator.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RGraphicCreator.java
@@ -14,8 +14,8 @@
package org.eclipse.statet.rj.services;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.graphic.core.RGraphic;
@@ -38,10 +38,13 @@
* @param width width in pixel
* @param height height in pixel
*/
- void setSize(double width, double height);
+ void setSize(final double width, final double height);
- RGraphic create(String expression, IProgressMonitor monitor) throws CoreException;
- RGraphic create(FunctionCall fcall, IProgressMonitor monitor) throws CoreException;
+ RGraphic create(final String expression,
+ final ProgressMonitor m) throws StatusException;
+
+ RGraphic create(final FunctionCall fcall,
+ final ProgressMonitor m) throws StatusException;
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RJServices.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RJServices.java
index d0f0753..3df2fd1 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RJServices.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RJServices.java
@@ -21,11 +21,10 @@
public class RJServices {
- public static final String BUNDLE_ID= "org.eclipse.statet.rj.services"; //$NON-NLS-1$
+ public static final String BUNDLE_ID= "org.eclipse.statet.rj.services.core"; //$NON-NLS-1$
private RJServices() {
}
-
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RPlatform.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RPlatform.java
index c513d86..40a4133 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RPlatform.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RPlatform.java
@@ -19,7 +19,8 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.osgi.framework.Version;
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.lang.Nullable;
/**
@@ -29,6 +30,7 @@
* The properties usually doesn't change for a single RService
* instance.
*/
+@NonNullByDefault
public final class RPlatform implements Externalizable {
/**
@@ -48,16 +50,13 @@
private String pathSep;
private String versionString;
- private transient Version version;
+ private @Nullable RVersion version;
private String osName;
private String osArch;
private String osVersion;
- public RPlatform() {
- }
-
public RPlatform(final String osType, final String fileSep, final String pathSep,
final String version,
final String osName, final String osArch, final String osVersion) {
@@ -71,6 +70,8 @@
this.osVersion= osVersion;
}
+ public RPlatform() {
+ }
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
@@ -117,11 +118,13 @@
return this.pathSep;
}
- public Version getRVersion() {
- if (this.version == null) {
- this.version= new Version(this.versionString);
+ public RVersion getRVersion() {
+ RVersion version= this.version;
+ if (version == null) {
+ version= new RVersion(this.versionString);
+ this.version= version;
}
- return this.version;
+ return version;
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RService.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RService.java
index 72276c7..29f43b9 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RService.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RService.java
@@ -17,11 +17,10 @@
import java.io.InputStream;
import java.io.OutputStream;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.data.RObject;
import org.eclipse.statet.rj.data.RReference;
@@ -33,7 +32,7 @@
* <p>
* It depends on the application how to get access to the RService.
* In StatET it is passed as adapter argument in
- * {@link org.eclipse.statet.ecommons.ts.core.IToolRunnable#run(org.eclipse.statet.ecommons.ts.core.IToolService, IProgressMonitor) IToolRunnable#run(...)},
+ * {@link org.eclipse.statet.ecommons.ts.core.IToolRunnable#run(org.eclipse.statet.ecommons.ts.core.IToolService, ProgressMonitor) IToolRunnable#run(...)},
* if the R console supports the featureset {@link org.eclipse.statet.r.core.tool.RTool#R_DATA_FEATURESET_ID RTool#R_DATA_FEATURESET_ID}.
* In applications using R in the background by the RServi library,
* the {@link org.eclipse.statet.rj.servi.RServi RServi} object provides the RService methods.</p>
@@ -112,12 +111,12 @@
* <p>The evaluation is performed in the global environment of R.</p>
*
* @param expression a single valid R expression to evaluate
- * @param monitor a progress monitor to catch cancellation and provide progress feedback.
- * @throws CoreException if the operation was canceled or failed; the status
+ * @param m a progress monitor to catch cancellation and provide progress feedback.
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- void evalVoid(String expression,
- IProgressMonitor monitor) throws CoreException;
+ void evalVoid(final String expression,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the given expression in R without returning a value.
@@ -128,33 +127,33 @@
* @param expression a single valid R expression to evaluate
* @param envir the environment where to perform the evaluation; specified by an reference
* or language object, or <code>null</code> for the global environment
- * @param monitor a progress monitor to catch cancellation and provide progress feedback.
- * @throws CoreException if the operation was canceled or failed; the status
+ * @param m a progress monitor to catch cancellation and provide progress feedback.
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*
* @since de.walware.rj.services 2.1
*/
- void evalVoid(String expression, @Nullable RObject envir,
- IProgressMonitor monitor) throws CoreException;
+ void evalVoid(final String expression, final @Nullable RObject envir,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the given expression in R and returns its value as R data object.
* The method returns after the evaluation is finished.
*
- * <p>This is a short version of {@link #evalData(String, String, int, int, IProgressMonitor)}
+ * <p>This is a short version of {@link #evalData(String, String, int, int, ProgressMonitor)}
* sufficient for most purpose. The returned R data objects are created by the default factory
* with no limit in the object tree depth.</p>
*
* <p>The evaluation is performed in the global environment of R.</p>
*
* @param expression a single valid R expression to evaluate
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the evaluated value as R data object
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- RObject evalData(String expression,
- IProgressMonitor monitor) throws CoreException;
+ RObject evalData(final String expression,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the given expression in R and returns its value. The method returns
@@ -168,17 +167,17 @@
* @param factoryId the id of the factory to use when creating the RObject in this VM.
* @param options 0
* @param depth object tree depth for the created return value
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the evaluated value as R data object
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*
* @see #DEPTH_INFINITE
* @see #DEPTH_ONE
*/
- RObject evalData(String expression,
- @Nullable String factoryId, int options, int depth,
- IProgressMonitor monitor) throws CoreException;
+ RObject evalData(final String expression,
+ final @Nullable String factoryId, final int options, final int depth,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the evaluation of the given expression in R and returns its value. The method
@@ -193,9 +192,9 @@
* @param factoryId the id of the factory to use when creating the RObject in this VM.
* @param options 0
* @param depth object tree depth for the created return value
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the evaluated value as R data object
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*
* @since de.walware.rj.services 2.1
@@ -203,15 +202,15 @@
* @see #DEPTH_INFINITE
* @see #DEPTH_ONE
*/
- RObject evalData(String expression, @Nullable RObject envir,
- @Nullable String factoryId, int options, int depth,
- IProgressMonitor monitor) throws CoreException;
+ RObject evalData(final String expression, final @Nullable RObject envir,
+ final @Nullable String factoryId, final int options, final int depth,
+ final ProgressMonitor m) throws StatusException;
- RObject evalData(RReference reference,
- IProgressMonitor monitor) throws CoreException;
- RObject evalData(RReference reference,
- @Nullable String factoryId, int options, int depth,
- IProgressMonitor monitor) throws CoreException;
+ RObject evalData(final RReference reference,
+ final ProgressMonitor m) throws StatusException;
+ RObject evalData(final RReference reference,
+ final @Nullable String factoryId, final int options, final int depth,
+ final ProgressMonitor m) throws StatusException;
/**
* Finds the first object with the specified name in the specified environment and optionally
@@ -227,15 +226,15 @@
* @param factoryId the id of the factory to use when creating the RObject in this VM.
* @param options
* @param depth object tree depth for the created return value
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return a fully qualified object with the object itself and the environment where the
* object is found, or <code>null</code> if no object is found
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- @Nullable FQRObject findData(String symbol, @Nullable RObject env, boolean inherits,
- @Nullable String factoryId, int options, int depth,
- IProgressMonitor monitor) throws CoreException;
+ @Nullable FQRObject<?> findData(final String symbol, final @Nullable RObject env, final boolean inherits,
+ final @Nullable String factoryId, final int options, final int depth,
+ final ProgressMonitor m) throws StatusException;
/**
* Performs the assignment of the given R data object to an expression in R. The method returns
@@ -250,15 +249,18 @@
*
* @param target a single valid expression to assign the data to
* @param data a valid R data object to assign to the expression
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the evaluated value as R data object
- * @throws CoreException if the operation was canceled or was failed; the status
+ * @throws StatusException if the operation was canceled or was failed; the status
* of the exception contains detail about the cause
*/
- void assignData(String target, RObject data,
- IProgressMonitor monitor) throws CoreException;
+ void assignData(final String target,
+ final RObject data,
+ final ProgressMonitor m) throws StatusException;
-// void assignDataToAttribute(String expression, String attributeName, RObject data, IProgressMonitor monitor) throws CoreException;
+// void assignDataToAttribute(final String expression, final String attributeName,
+// final RObject data,
+// final ProgressMonitor m) throws StatusException;
/**
* Uploads a file or an other input stream to a file on the R host system.
@@ -287,14 +289,17 @@
* @param length the length of the content
* @param fileName the name of the file on the R host system
* @param options 0
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
- * @throws CoreException if the operation was canceled or failed; the status
+ * @param m a progress monitor to catch cancellation and provide progress feedback
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- void uploadFile(InputStream in, long length, String fileName, int options,
- IProgressMonitor monitor) throws CoreException;
+ void uploadFile(final InputStream in, final long length, final String fileName,
+ final int options,
+ final ProgressMonitor m) throws StatusException;
-// void uploadFile(byte[], long length, String fileName, int options, IProgressMonitor monitor) throws CoreException;
+// void uploadFile(final byte[], final long length, final String fileName,
+// final int options,
+// final ProgressMonitor m) throws StatusException;
/**
* Downloads a file on the R host system to a local file or another output stream.
@@ -322,12 +327,13 @@
* @param out the output stream to write the content of the file to
* @param fileName the name of the file on the R host system
* @param options 0
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
- * @throws CoreException if the operation was canceled or failed; the status
+ * @param m a progress monitor to catch cancellation and provide progress feedback
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- void downloadFile(OutputStream out, String fileName, int options,
- IProgressMonitor monitor) throws CoreException;
+ void downloadFile(final OutputStream out, final String fileName,
+ final int options,
+ final ProgressMonitor m) throws StatusException;
/**
* Downloads a file on the R host system into a byte array.
@@ -341,13 +347,14 @@
*
* @param fileName the name of the file on the R host system
* @param options 0
- * @param monitor a progress monitor to catch cancellation and provide progress feedback
+ * @param m a progress monitor to catch cancellation and provide progress feedback
* @return the file content
- * @throws CoreException if the operation was canceled or failed; the status
+ * @throws StatusException if the operation was canceled or failed; the status
* of the exception contains detail about the cause
*/
- byte[] downloadFile(String fileName, int options,
- IProgressMonitor monitor) throws CoreException;
+ byte[] downloadFile(final String fileName,
+ final int options,
+ final ProgressMonitor m) throws StatusException;
/**
* Creates a new function call builder for the specified function.
@@ -358,10 +365,10 @@
* @param name the name of the function, optional with prefix namespace
*
* @return a new function creator
- * @throws CoreException if the operation failed; the status
+ * @throws StatusException if the operation failed; the status
* of the exception contains detail about the cause
*/
- FunctionCall createFunctionCall(String name) throws CoreException;
+ FunctionCall createFunctionCall(final String name) throws StatusException;
/**
* Creates a new creator for {@link RGraphic}s.
@@ -374,13 +381,13 @@
*
* @param options optional options, <code>0</code> for default
* @return a new graphic creator
- * @throws CoreException if the operation failed; the status
+ * @throws StatusException if the operation failed; the status
* of the exception contains detail about the cause
*
* @since de.walware.rj.services 0.5
*/
- RGraphicCreator createRGraphicCreator(int options) throws CoreException;
-// void beginCatchRGraphics(int options);
+ RGraphicCreator createRGraphicCreator(final int options) throws StatusException;
+// void beginCatchRGraphics(final int options);
// Map<String, RGraphic> endCatchRGraphics();
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RServiceControlExtension.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RServiceControlExtension.java
index 15b13d3..2d583df 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RServiceControlExtension.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RServiceControlExtension.java
@@ -17,9 +17,8 @@
import java.util.concurrent.Callable;
import java.util.concurrent.locks.Lock;
-import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
/**
@@ -29,6 +28,7 @@
@NonNullByDefault
public interface RServiceControlExtension {
+
/**
* Adds a cancel handler called when the tool is canceled to the stack of cancel handlers.
* <p>
@@ -37,14 +37,15 @@
*
* @param handler the handler
*/
- void addCancelHandler(Callable<Boolean> handler);
+ void addCancelHandler(final Callable<Boolean> handler);
/**
* Removes a cancel handler from the stack of cancel handlers.
*
* @param handler the handler
*/
- void removeCancelHandler(Callable<Boolean> handler);
+ void removeCancelHandler(final Callable<Boolean> handler);
+
/**
* The lock for wait operations.
@@ -62,12 +63,12 @@
* The current thread must hold the lock {@link #getWaitLock()}. The method returns after a
* short waiting time, operations are executed <b>or</b> {@link #resume()} is called.</p>
*
- * @param monitor the current monitor
+ * @param m the current monitor
*/
- void waitingForUser(IProgressMonitor monitor);
+ void waitingForUser(final ProgressMonitor m);
/**
- * Resumes the tool thread which is waiting in {@link #waitingForUser(IProgressMonitor)}.
+ * Resumes the tool thread which is waiting in {@link #waitingForUser(ProgressMonitor)}.
*/
void resume();
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RVersion.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RVersion.java
new file mode 100644
index 0000000..fe594ed
--- /dev/null
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/RVersion.java
@@ -0,0 +1,189 @@
+/*=============================================================================#
+ # Copyright (c) 2017, 2018 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.rj.services;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.lang.ObjectUtils;
+
+
+@NonNullByDefault
+public class RVersion implements Comparable<RVersion> {
+
+ private static int parseInt(final String value, final String componentName) {
+ try {
+ return Integer.parseInt(value);
+ }
+ catch (final NumberFormatException e) {
+ throw new IllegalArgumentException(componentName + "= '" + value + "'", e);
+ }
+ }
+
+ private static void validateInt(final int value, final String componentName) {
+ if (value < 0) {
+ throw new IllegalArgumentException(componentName + "= " + value);
+ }
+ }
+
+
+ private final int major;
+ private final int minor;
+ private final int patch;
+ private final String build;
+
+ private transient @Nullable String versionString;
+ private transient int hash;
+
+
+ public RVersion(final int major, final int minor, final int micro,
+ final @Nullable String qualifier) {
+ this.major= major;
+ this.minor= minor;
+ this.patch= micro;
+ this.build= ObjectUtils.nonNullElse(qualifier, ""); //$NON-NLS-1$
+ validate();
+ }
+
+ public RVersion(final int major, final int minor, final int path) {
+ this(major, minor, path, null);
+ }
+
+ public RVersion(final String version) {
+ int major= 0;
+ int minor= 0;
+ int patch= 0;
+ String build= "";
+ { final String[] components= version.split("\\.", 4);
+ if (components.length == 0 || components[0].isEmpty()) {
+ throw new IllegalArgumentException("version= '" + version + "'");
+ }
+ major= parseInt(components[0], "major");
+ if (components.length >= 2) {
+ minor= parseInt(components[1], "minor");
+ if (components.length >= 3) {
+ patch= parseInt(components[2], "patch");
+ if (components.length >= 4) {
+ build= components[3];
+ }
+ }
+ }
+ }
+
+ this.major= major;
+ this.minor= minor;
+ this.patch= patch;
+ this.build= build;
+ validate();
+ }
+
+ private void validate() {
+ validateInt(this.major, "major");
+ validateInt(this.minor, "minor");
+ validateInt(this.patch, "patch");
+ for (int i= 0; i < this.build.length(); i++) {
+ final char c= this.build.charAt(i);
+ if (!Character.isDefined(c) || c == ' ') {
+ throw new IllegalArgumentException("build= " + this.build);
+ }
+ }
+ }
+
+
+ public int getMajor() {
+ return this.major;
+ }
+
+ public int getMinor() {
+ return this.minor;
+ }
+
+ public int getMicro() {
+ return this.patch;
+ }
+
+ public String getBuild() {
+ return this.build;
+ }
+
+
+ @Override
+ public int hashCode() {
+ int h= this.hash;
+ if (h != 0) {
+ return h;
+ }
+ h= 31 * 17;
+ h= 31 * h + this.major;
+ h= 31 * h + this.minor;
+ h= 31 * h + this.patch;
+ h= 31 * h + this.build.hashCode();
+ return this.hash= h;
+ }
+
+ @Override
+ public boolean equals(final @Nullable Object object) {
+ if (this == object) {
+ return true;
+ }
+ if (object instanceof RVersion) {
+ final RVersion other= (RVersion) object;
+ return ((this.major == other.major)
+ && (this.minor == other.minor)
+ && (this.patch == other.patch)
+ && this.build.equals(other.build) );
+ }
+ return false;
+ }
+
+ @Override
+ public int compareTo(final RVersion other) {
+ if (this == other) {
+ return 0;
+ }
+ int result= this.major - other.major;
+ if (result != 0) {
+ return result;
+ }
+ result= this.minor - other.minor;
+ if (result != 0) {
+ return result;
+ }
+ result= this.patch - other.patch;
+ if (result != 0) {
+ return result;
+ }
+ return this.build.compareTo(other.build);
+ }
+
+ @Override
+ public String toString() {
+ final String s= this.versionString;
+ if (s != null) {
+ return s;
+ }
+ final StringBuilder result= new StringBuilder(20 + this.build.length());
+ result.append(this.major);
+ result.append('.');
+ result.append(this.minor);
+ result.append('.');
+ result.append(this.patch);
+ if (!this.build.isEmpty()) {
+ result.append('.');
+ result.append(this.build);
+ }
+ return this.versionString= result.toString();
+ }
+
+}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/Graphic.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/Graphic.java
index 30ae3e6..4f0ccac 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/Graphic.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/Graphic.java
@@ -16,8 +16,8 @@
import java.io.OutputStream;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.services.FunctionCall;
import org.eclipse.statet.rj.services.RService;
@@ -50,7 +50,7 @@
* The default is pixel for raster graphic images (png) and inch for vector images (pdf).
*
* @param width the width in the given unit
- * @param height the height in the given unit
+ * @param height the height in the given unit
* @param unit the unit of width and height arguments
*/
public void setSize(final double width, final double height, final String unit) {
@@ -69,38 +69,43 @@
}
- public byte[] create(final FunctionCall plot, final RService service, final IProgressMonitor monitor) throws CoreException {
+ public byte[] create(final FunctionCall plot,
+ final RService service, final ProgressMonitor m) throws StatusException {
final String filename= "plot-"+System.nanoTime()+".plot";
- prepare(filename, service, monitor);
- plot.evalVoid(monitor);
- service.evalVoid("dev.off()", monitor);
- return service.downloadFile(filename, 0, monitor);
+ prepare(filename, service, m);
+ plot.evalVoid(m);
+ service.evalVoid("dev.off()", m);
+ return service.downloadFile(filename, 0, m);
}
- public void create(final FunctionCall plot, final OutputStream out, final RService service, final IProgressMonitor monitor) throws CoreException {
+ public void create(final FunctionCall plot, final OutputStream out,
+ final RService service, final ProgressMonitor m) throws StatusException {
final String filename= "plot-"+System.nanoTime()+".plot";
- prepare(filename, service, monitor);
- plot.evalVoid(monitor);
- service.evalVoid("dev.off()", monitor);
- service.downloadFile(out, filename, 0, monitor);
+ prepare(filename, service, m);
+ plot.evalVoid(m);
+ service.evalVoid("dev.off()", m);
+ service.downloadFile(out, filename, 0, m);
}
- public byte[] create(final String plotCommand, final RService service, final IProgressMonitor monitor) throws CoreException {
+ public byte[] create(final String plotCommand,
+ final RService service, final ProgressMonitor m) throws StatusException {
final String filename= "plot-"+System.nanoTime()+".plot";
- prepare(filename, service, monitor);
- service.evalVoid(plotCommand, monitor);
- service.evalVoid("dev.off()", monitor);
- return service.downloadFile(filename, 0, monitor);
+ prepare(filename, service, m);
+ service.evalVoid(plotCommand, m);
+ service.evalVoid("dev.off()", m);
+ return service.downloadFile(filename, 0, m);
}
- public void create(final String plotCommand, final OutputStream out, final RService service, final IProgressMonitor monitor) throws CoreException {
+ public void create(final String plotCommand, final OutputStream out,
+ final RService service, final ProgressMonitor m) throws StatusException {
final String filename= "plot-"+System.nanoTime()+".plot";
- prepare(filename, service, monitor);
- service.evalVoid(plotCommand, monitor);
- service.evalVoid("dev.off()", monitor);
- service.downloadFile(out, filename, 0, monitor);
+ prepare(filename, service, m);
+ service.evalVoid(plotCommand, m);
+ service.evalVoid("dev.off()", m);
+ service.downloadFile(out, filename, 0, m);
}
- protected abstract void prepare(String filename, RService service, IProgressMonitor monitor) throws CoreException;
+ protected abstract void prepare(final String filename,
+ final RService service, final ProgressMonitor m) throws StatusException;
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PdfGraphic.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PdfGraphic.java
index a2304ed..6105084 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PdfGraphic.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PdfGraphic.java
@@ -14,8 +14,8 @@
package org.eclipse.statet.rj.services.util;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.services.FunctionCall;
import org.eclipse.statet.rj.services.RService;
@@ -37,7 +37,8 @@
}
@Override
- protected void prepare(final String filename, final RService service, final IProgressMonitor monitor) throws CoreException {
+ protected void prepare(final String filename,
+ final RService service, final ProgressMonitor m) throws StatusException {
final FunctionCall png= service.createFunctionCall("pdf"); //$NON-NLS-1$
png.addChar("file", filename); //$NON-NLS-1$
if (this.resolution > 0) {
@@ -57,7 +58,7 @@
png.addNum("height", this.sizeHeight/25.4); //$NON-NLS-1$
}
}
- png.evalVoid(monitor);
+ png.evalVoid(m);
}
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PngGraphic.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PngGraphic.java
index 88af77e..6489cac 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PngGraphic.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/PngGraphic.java
@@ -14,8 +14,8 @@
package org.eclipse.statet.rj.services.util;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.services.FunctionCall;
import org.eclipse.statet.rj.services.RPlatform;
@@ -30,7 +30,8 @@
@Override
- protected void prepare(final String filename, final RService service, final IProgressMonitor monitor) throws CoreException {
+ protected void prepare(final String filename,
+ final RService service, final ProgressMonitor m) throws StatusException {
final FunctionCall png= service.createFunctionCall("png");
png.addChar("filename", filename);
if (this.resolution > 0) {
@@ -44,7 +45,7 @@
if (service.getPlatform().getOsType().equals(RPlatform.OS_WINDOWS)) {
png.addLogi("restoreConsole", false);
}
- png.evalVoid(monitor);
+ png.evalVoid(m);
}
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/RPkgInstallation.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/RPkgInstallation.java
index 427ea1d..30d1f10 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/RPkgInstallation.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/RPkgInstallation.java
@@ -19,10 +19,9 @@
import java.io.IOException;
import java.text.MessageFormat;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.data.RDataUtils;
import org.eclipse.statet.rj.data.RIntegerStore;
@@ -40,7 +39,7 @@
/**
* Utility to install an R package from a local file.
* <p>
- * Run {@link #install(RService, IProgressMonitor)} to install the package.</p>
+ * Run {@link #install(RService, ProgressMonitor)} to install the package.</p>
* <p>
* The class can be reused.</p>
*
@@ -54,7 +53,7 @@
private final File file;
- public RPkgInstallation(final File file) throws CoreException {
+ public RPkgInstallation(final File file) throws StatusException {
if (file == null) {
throw new NullPointerException();
}
@@ -71,12 +70,12 @@
return this.file.getName();
}
- protected void uploadPkgFile(final String target, final RService r,
- final IProgressMonitor monitor) throws CoreException, IOException {
+ protected void uploadPkgFile(final String target,
+ final RService r, final ProgressMonitor m) throws StatusException, IOException {
FileInputStream in= null;
try {
in= new FileInputStream(this.file);
- r.uploadFile(in, this.file.length(), target, 0, monitor);
+ r.uploadFile(in, this.file.length(), target, 0, m);
}
finally {
if (in != null) {
@@ -88,7 +87,7 @@
}
}
- public void install(final RService r, final IProgressMonitor monitor) throws CoreException {
+ public void install(final RService r, final ProgressMonitor m) throws StatusException {
final String source= getPkgFileName();
final RPkgType pkgType= RPkgUtils.checkPkgType(source, r.getPlatform());
@@ -97,11 +96,11 @@
String libLoc= null;
try {
{ final RVector<RIntegerStore> data= RDataUtils.checkRIntVector(r.evalData(
- "rj:::renv.isValidLibLoc(.libPaths()[1])", monitor )); //$NON-NLS-1$
+ "rj:::renv.isValidLibLoc(.libPaths()[1])", m )); //$NON-NLS-1$
final int state= RDataUtils.checkSingleIntValue(data);
libLoc= data.getNames().getChar(0);
if (state != 0) {
- throw new CoreException(new Status(IStatus.ERROR, RJServices.BUNDLE_ID,
+ throw new StatusException(new ErrorStatus(RJServices.BUNDLE_ID,
MessageFormat.format("The library location ''{0}'' is not writable.", libLoc) ));
}
}
@@ -109,48 +108,50 @@
{ final FunctionCall call= r.createFunctionCall("dir.create"); //$NON-NLS-1$
call.addChar("rpkgs"); //$NON-NLS-1$
call.addLogi("showWarnings", false); //$NON-NLS-1$
- call.evalVoid(monitor);
+ call.evalVoid(m);
serverFile= "rpkgs/" + source; //$NON-NLS-1$
}
- uploadPkgFile(serverFile, r, monitor);
+ uploadPkgFile(serverFile, r, m);
{ final FunctionCall call= r.createFunctionCall("install.packages"); //$NON-NLS-1$
call.addChar(serverFile);
call.addChar("lib", libLoc); //$NON-NLS-1$
call.addNull("repos"); //$NON-NLS-1$
call.addChar("type", RPkgUtils.getPkgTypeInstallKey(r.getPlatform(), pkgType)); //$NON-NLS-1$
- call.evalVoid(monitor);
+ call.evalVoid(m);
}
{ final FunctionCall call= r.createFunctionCall("packageDescription"); //$NON-NLS-1$
call.addChar("pkg", this.pkgInfo.getName()); //$NON-NLS-1$
call.addChar("lib.loc", libLoc); //$NON-NLS-1$
call.addChar("fields", "Version"); //$NON-NLS-1$ //$NON-NLS-2$
- final RVector<?> data= RDataUtils.checkRVector(call.evalData(monitor));
+ final RVector<?> data= RDataUtils.checkRVector(call.evalData(m));
try {
final String s= RDataUtils.checkSingleCharValue(data);
final RNumVersion installedVersion= RNumVersion.create(s);
if (!installedVersion.equals(this.pkgInfo.getVersion())) {
- throw new CoreException(new Status(IStatus.ERROR, RJServices.BUNDLE_ID,
- MessageFormat.format("Validation of package installation failed: installed package has different version (found= {0}, expected= {1}).",
- installedVersion.toString(), this.pkgInfo.getVersion().toString() )));
+ throw new StatusException(new ErrorStatus(RJServices.BUNDLE_ID,
+ String.format("Validation of package installation failed: " +
+ "installed package has different version (found= %1$s, expected= %2$s).",
+ installedVersion.toString(),
+ this.pkgInfo.getVersion().toString() )));
}
}
catch (final UnexpectedRDataException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJServices.BUNDLE_ID,
+ throw new StatusException(new ErrorStatus(RJServices.BUNDLE_ID,
"Validation of package installation failed: no installed package found." ));
}
}
- clear(serverFile, r, monitor);
+ clear(serverFile, r, m);
serverFile= null;
}
catch (final IOException e) {
error= e;
}
- catch (final CoreException e) {
+ catch (final StatusException e) {
error= e;
}
catch (final UnexpectedRDataException e) {
@@ -159,22 +160,24 @@
finally {
if (serverFile != null) {
try {
- clear(serverFile, r, monitor);
+ clear(serverFile, r, m);
}
catch (final Exception e) {}
}
}
if (error != null) {
- throw new CoreException(new Status(IStatus.ERROR, RJServices.BUNDLE_ID,
- MessageFormat.format("An error occurred when installing R package from {0}.",
- source), error ));
+ throw new StatusException(new ErrorStatus(RJServices.BUNDLE_ID,
+ String.format("An error occurred when installing R package from %1$s.",
+ source ),
+ error ));
}
}
- private void clear(final String target, final RService r, final IProgressMonitor monitor) throws CoreException {
+ private void clear(final String target,
+ final RService r, final ProgressMonitor m) throws StatusException {
final FunctionCall call= r.createFunctionCall("file.remove"); //$NON-NLS-1$
call.addChar(target);
- call.evalVoid(monitor);
+ call.evalVoid(m);
}
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/AbstractRDataAdapter.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/AbstractRDataAdapter.java
index bc01d89..ef3ed4d 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/AbstractRDataAdapter.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/AbstractRDataAdapter.java
@@ -14,8 +14,8 @@
package org.eclipse.statet.rj.services.util.dataaccess;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.data.RDataUtils;
import org.eclipse.statet.rj.data.RLanguage;
@@ -61,7 +61,7 @@
public void check(final FQRObjectRef ref, final TRObject referenceObject,
- final RService r, final IProgressMonitor monitor) throws CoreException,
+ final RService r, final ProgressMonitor m) throws StatusException,
UnexpectedRDataException {
final RObject result;
{ final FunctionCall fcall= r.createFunctionCall(API_R_PREFIX + ".checkDataStruct"); //$NON-NLS-1$
@@ -71,7 +71,7 @@
getRowCount(referenceObject),
getColumnCount(referenceObject),
}));
- result= fcall.evalData(monitor);
+ result= fcall.evalData(m);
}
if (RDataUtils.checkSingleLogiValue(result) == false) {
throw new UnexpectedRDataException("It seems something changed.");
@@ -80,8 +80,7 @@
public TFragmentObject loadData(final FQRObjectRef ref, final TRObject referenceObject,
final LazyRStore.Fragment<TFragmentObject> fragment, final String rowMapping,
- final RService r,
- final IProgressMonitor monitor) throws CoreException, UnexpectedRDataException {
+ final RService r, final ProgressMonitor m) throws StatusException, UnexpectedRDataException {
final RObject fragmentObject;
{ final FunctionCall fcall= r.createFunctionCall(getLoadDataFName());
addXRef(fcall, ref);
@@ -95,7 +94,7 @@
fcall.addChar("rowMapping", rowMapping); //$NON-NLS-1$
}
- fragmentObject= fcall.evalData(null, getLoadOptions(), RService.DEPTH_INFINITE, monitor);
+ fragmentObject= fcall.evalData(null, getLoadOptions(), RService.DEPTH_INFINITE, m);
}
return validateData(fragmentObject, referenceObject, fragment);
@@ -113,8 +112,7 @@
public void setData(final FQRObjectRef ref, final TRObject referenceObject,
final RDataAssignment assignment, final String rowMapping,
- final RService r,
- final IProgressMonitor monitor) throws CoreException, UnexpectedRDataException {
+ final RService r, final ProgressMonitor m) throws StatusException, UnexpectedRDataException {
{ final FunctionCall fcall= r.createFunctionCall(getSetDataFName());
addXRef(fcall, ref);
fcall.add("idxs", DefaultRObjectFactory.INSTANCE.createNumVector(new double[] { //$NON-NLS-1$
@@ -129,7 +127,7 @@
fcall.add("values", DefaultRObjectFactory.INSTANCE.createVector( //$NON-NLS-1$
assignment.getData() ));
- fcall.evalVoid(monitor);
+ fcall.evalVoid(m);
}
}
@@ -137,8 +135,7 @@
public RVector<?> loadRowNames(final FQRObjectRef ref, final TRObject referenceObject,
final LazyRStore.Fragment<RVector<?>> fragment, final String rowMapping,
- final RService r, final IProgressMonitor monitor) throws CoreException,
- UnexpectedRDataException {
+ final RService r, final ProgressMonitor m) throws StatusException, UnexpectedRDataException {
final RObject fragmentObject;
{ final FunctionCall fcall= r.createFunctionCall(getLoadRowNamesFName());
addXRef(fcall, ref);
@@ -150,7 +147,7 @@
fcall.addChar("rowMapping", rowMapping); //$NON-NLS-1$
}
- fragmentObject= fcall.evalData(monitor);
+ fragmentObject= fcall.evalData(m);
}
return validateRowNames(fragmentObject, referenceObject, fragment);
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/LazyRStore.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/LazyRStore.java
index 8a5d722..793f927 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/LazyRStore.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/LazyRStore.java
@@ -17,8 +17,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+
/**
*
@@ -82,9 +83,9 @@
public static interface Updater<T> {
- void scheduleUpdate(LazyRStore<T> store,
- RDataAssignment assignment, Fragment<T> fragment,
- int flags, IProgressMonitor monitor);
+ void scheduleUpdate(final LazyRStore<T> store,
+ final RDataAssignment assignment, final Fragment<T> fragment,
+ final int flags, final ProgressMonitor m);
}
@@ -161,7 +162,7 @@
public LazyRStore.Fragment<V> getFragment(final long rowIdx, final long columnIdx,
- final int flags, final IProgressMonitor monitor) {
+ final int flags, final ProgressMonitor m) {
if (rowIdx >= this.rowCount) {
return null;
}
@@ -182,7 +183,7 @@
}
if (scheduleUpdate || (flags & FORCE_SYNC) != 0) {
- this.updater.scheduleUpdate(this, null, fragment, flags, monitor);
+ this.updater.scheduleUpdate(this, null, fragment, flags, m);
if ((fragment.state & Fragment.SET) != 0) {
return fragment;
@@ -224,7 +225,7 @@
}
public void set(final RDataAssignment assignment,
- final int flags, final IProgressMonitor monitor) {
+ final int flags, final ProgressMonitor m) {
final Fragment<V> fragment= clear(assignment);
this.assignments.add(assignment);
@@ -238,13 +239,13 @@
}
if (scheduleUpdate) {
- this.updater.scheduleUpdate(this, assignment, fragment, flags, monitor);
+ this.updater.scheduleUpdate(this, assignment, fragment, flags, m);
}
}
public Fragment<V> clear(final RDataSubset subset) {
Fragment<V> firstFragment= null;
- long columnBeginIdx= (subset.getColumnBeginIdx() / this.fragmentColCount) * this.fragmentColCount;
+ long columnBeginIdx= (subset.getColumnBeginIdx() / this.fragmentColCount) * this.fragmentColCount;
while (columnBeginIdx < subset.getColumnEndIdx()) {
long rowBeginIdx= (subset.getRowBeginIdx() / this.fragmentRowCount) * this.fragmentRowCount;
while (rowBeginIdx < subset.getRowEndIdx()) {
@@ -343,7 +344,7 @@
private Fragment<V> createFragment(final long number) {
final long rowBeginIdx= (number / this.fragmentCountInRow) * this.fragmentRowCount;
final long rowEndIdx= Math.min(rowBeginIdx + this.fragmentRowCount, this.rowCount);
- final long columnBeginIdx= (number % this.fragmentCountInRow) * this.fragmentColCount;
+ final long columnBeginIdx= (number % this.fragmentCountInRow) * this.fragmentColCount;
final long columnEndIdx= Math.min(columnBeginIdx + this.fragmentColCount, this.columnCount);
return new Fragment<>(number,
rowBeginIdx, (rowEndIdx - rowBeginIdx),
@@ -434,7 +435,7 @@
}
}
- public void updateAssignment(final RDataAssignment assignment, final IStatus status) {
+ public void updateAssignment(final RDataAssignment assignment, final Status status) {
if (this.assignments.remove(assignment)) {
this.scheduledCount--;
}
diff --git a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/RArrayAsVectorDataAdapter.java b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/RArrayAsVectorDataAdapter.java
index 33e1318..27cef2e 100644
--- a/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/RArrayAsVectorDataAdapter.java
+++ b/core/org.eclipse.statet.rj.services.core/src/org/eclipse/statet/rj/services/util/dataaccess/RArrayAsVectorDataAdapter.java
@@ -14,8 +14,8 @@
package org.eclipse.statet.rj.services.util.dataaccess;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.data.RArray;
import org.eclipse.statet.rj.data.RDataUtils;
@@ -95,8 +95,7 @@
public RVector<?> loadDimNames(final FQRObjectRef ref, final RArray<?> referenceObject,
final LazyRStore.Fragment<RVector<?>> fragment,
- final RService r,
- final IProgressMonitor monitor) throws CoreException, UnexpectedRDataException {
+ final RService r, final ProgressMonitor m) throws StatusException, UnexpectedRDataException {
final RObject fragmentObject;
{ final FunctionCall fcall= r.createFunctionCall(API_R_PREFIX + ".getDataArrayDimNames"); //$NON-NLS-1$
addXRef(fcall, ref);
@@ -105,7 +104,7 @@
fragment.getRowEndIdx(),
}));
- fragmentObject= fcall.evalData(monitor);
+ fragmentObject= fcall.evalData(m);
}
return validateRowNames(fragmentObject, referenceObject, fragment);
@@ -113,8 +112,7 @@
public RVector<?> loadDimItemNames(final FQRObjectRef ref, final RArray<?> referenceObject,
final int dim, final LazyRStore.Fragment<RVector<?>> fragment,
- final RService r,
- final IProgressMonitor monitor) throws CoreException, UnexpectedRDataException {
+ final RService r, final ProgressMonitor m) throws StatusException, UnexpectedRDataException {
final RObject fragmentObject;
{ final FunctionCall fcall= r.createFunctionCall(API_R_PREFIX + ".getDataArrayDimItemNames"); //$NON-NLS-1$
addXRef(fcall, ref);
@@ -124,7 +122,7 @@
fragment.getRowEndIdx(),
}));
- fragmentObject= fcall.evalData(monitor);
+ fragmentObject= fcall.evalData(m);
}
return validateRowNames(fragmentObject, referenceObject, fragment);
diff --git a/core/org.eclipse.statet.rj.services.core/srcREnv/org/eclipse/statet/rj/renv/core/RPkgUtils.java b/core/org.eclipse.statet.rj.services.core/srcREnv/org/eclipse/statet/rj/renv/core/RPkgUtils.java
index 71b3bf6..58ed2a7 100644
--- a/core/org.eclipse.statet.rj.services.core/srcREnv/org/eclipse/statet/rj/renv/core/RPkgUtils.java
+++ b/core/org.eclipse.statet.rj.services.core/srcREnv/org/eclipse/statet/rj/renv/core/RPkgUtils.java
@@ -14,11 +14,8 @@
package org.eclipse.statet.rj.renv.core;
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.services.RJServices;
import org.eclipse.statet.rj.services.RPlatform;
@@ -55,11 +52,12 @@
return null;
}
- public static RPkgType checkPkgType(final String fileName, final RPlatform rPlatform) throws CoreException {
+ public static RPkgType checkPkgType(final String fileName, final RPlatform rPlatform)
+ throws StatusException {
final RPkgType pkgType= getPkgType(fileName, rPlatform);
if (pkgType == null) {
- throw new CoreException(new Status(IStatus.ERROR, RJServices.BUNDLE_ID,
- MessageFormat.format("Invalid file name ''{0}'' (unsupported extension) for R package on {1}.",
+ throw new StatusException(new ErrorStatus(RJServices.BUNDLE_ID,
+ String.format("Invalid file name '%1$s' (unsupported extension) for R package on %2$s.",
fileName, rPlatform.getOSName() )));
}
return pkgType;
@@ -70,9 +68,10 @@
*
* @param fileName the file name to check
* @return a R package object with the detected name and version.
- * @throws CoreException if the file name has not the standard format.
+ * @throws StatusException if the file name has not the standard format.
*/
- public static RPkg checkPkgFileName(final String fileName) throws CoreException {
+ public static RPkg checkPkgFileName(final String fileName)
+ throws StatusException {
final int extIdx;
if (fileName.endsWith(".tar.gz")) { //$NON-NLS-1$
extIdx= fileName.length() - 7;
@@ -81,15 +80,15 @@
extIdx= fileName.length() - 4;
}
else {
- throw new CoreException(new Status(IStatus.ERROR, RJServices.BUNDLE_ID,
- MessageFormat.format("Invalid file name ''{0}'' (unsupported extension) for R package.",
+ throw new StatusException(new ErrorStatus(RJServices.BUNDLE_ID,
+ String.format("Invalid file name '%1$s' (unsupported extension) for R package.",
fileName )));
}
final int versionIdx= fileName.indexOf('_');
if (versionIdx < 0) {
- throw new CoreException(new Status(IStatus.ERROR, RJServices.BUNDLE_ID,
- MessageFormat.format("Invalid file name ''{0}'' (missing version) for R package.",
+ throw new StatusException(new ErrorStatus(RJServices.BUNDLE_ID,
+ String.format("Invalid file name '%1$s' (missing version) for R package.",
fileName )));
}
return new BasicRPkg(fileName.substring(0, versionIdx),
diff --git a/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/AbstractRToolCommandHandler.java b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/AbstractRToolCommandHandler.java
new file mode 100644
index 0000000..4b448a1
--- /dev/null
+++ b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/AbstractRToolCommandHandler.java
@@ -0,0 +1,43 @@
+/*=============================================================================#
+ # Copyright (c) 2012, 2018 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.rj.ts.core;
+
+import java.util.Map;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.ToolCommandHandler;
+import org.eclipse.statet.jcommons.ts.core.ToolService;
+
+
+/**
+ * @since 1.2
+ */
+@NonNullByDefault
+public abstract class AbstractRToolCommandHandler implements ToolCommandHandler {
+
+
+ @Override
+ public Status execute(final String id, final ToolService service, final Map<String, Object> data,
+ final ProgressMonitor m) throws StatusException {
+ return execute(id, (RToolService) service, data, m);
+ }
+
+ protected abstract Status execute(final String id, final RToolService r, final Map<String, Object> data,
+ final ProgressMonitor m) throws StatusException;
+
+}
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/AbstractRToolRunnable.java b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/AbstractRToolRunnable.java
similarity index 71%
rename from eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/AbstractRToolRunnable.java
rename to core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/AbstractRToolRunnable.java
index e9cb3a1..0362aaa 100644
--- a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/AbstractRToolRunnable.java
+++ b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/AbstractRToolRunnable.java
@@ -12,22 +12,20 @@
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
-package org.eclipse.statet.rj.eclient.core;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+package org.eclipse.statet.rj.ts.core;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-
-import org.eclipse.statet.ecommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.ts.core.ToolRunnable;
-import org.eclipse.statet.ecommons.ts.core.ToolService;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.Tool;
+import org.eclipse.statet.jcommons.ts.core.ToolRunnable;
+import org.eclipse.statet.jcommons.ts.core.ToolService;
/**
* Abstract runnable for R tool.
*
- * Sub class should implement at least the method {@link #run(RToolService, IProgressMonitor)},
+ * Sub class should implement at least the method {@link #run(RToolService, ProgressMonitor)},
* which is called by the R tool and gives access to the {@link RToolService} API.
*
* @since 1.2
@@ -58,7 +56,7 @@
@Override
public boolean canRunIn(final Tool tool) {
- return tool.isProvidingFeatureSet("org.eclipse.statet.rj.services.RService"); //$NON-NLS-1$
+ return tool.isProvidingFeatureSet(RTool.R_SERVICE_FEATURE_ID);
}
@Override
@@ -68,11 +66,11 @@
@Override
public void run(final ToolService service,
- final IProgressMonitor monitor) throws CoreException {
- run((RToolService) service, monitor);
+ final ProgressMonitor m) throws StatusException {
+ run((RToolService) service, m);
}
- protected abstract void run(RToolService r,
- IProgressMonitor monitor) throws CoreException;
+ protected abstract void run(final RToolService r,
+ final ProgressMonitor m) throws StatusException;
}
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/RToolService.java b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/RTool.java
similarity index 63%
rename from eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/RToolService.java
rename to core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/RTool.java
index a1309a5..f8440c9 100644
--- a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/RToolService.java
+++ b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/RTool.java
@@ -1,5 +1,5 @@
/*=============================================================================#
- # Copyright (c) 2012, 2018 Stephan Wahlbrink and others.
+ # Copyright (c) 2006, 2018 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
@@ -12,19 +12,25 @@
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
-package org.eclipse.statet.rj.eclient.core;
+package org.eclipse.statet.rj.ts.core;
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-
-import org.eclipse.statet.ecommons.ts.core.ToolService;
-
-import org.eclipse.statet.rj.services.RService;
+import org.eclipse.statet.jcommons.ts.core.Tool;
-/**
- * @since 1.2
- */
@NonNullByDefault
-public interface RToolService extends ToolService, RService {
+public interface RTool extends Tool {
+
+
+ /**
+ * Tool type of R instances.
+ *
+ * @see Tool#getMainType()
+ */
+ String TYPE= "R"; //$NON-NLS-1$
+
+
+ String R_SERVICE_FEATURE_ID= "org.eclipse.statet.rj.services.RService"; //$NON-NLS-1$
+
}
diff --git a/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/RToolService.java b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/RToolService.java
new file mode 100644
index 0000000..1a763a4
--- /dev/null
+++ b/core/org.eclipse.statet.rj.services.core/srcToolService/org/eclipse/statet/rj/ts/core/RToolService.java
@@ -0,0 +1,44 @@
+/*=============================================================================#
+ # Copyright (c) 2012, 2018 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.rj.ts.core;
+
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.ToolService;
+
+import org.eclipse.statet.rj.data.RObject;
+import org.eclipse.statet.rj.services.FQRObject;
+import org.eclipse.statet.rj.services.RService;
+
+
+/**
+ * @since 1.2
+ */
+@NonNullByDefault
+public interface RToolService extends ToolService, RService {
+
+
+ @Override
+ RTool getTool();
+
+
+ @Override
+ @Nullable FQRObject<? extends RTool> findData(final String symbol, final @Nullable RObject env, final boolean inherits,
+ final @Nullable String factoryId, final int options, final int depth,
+ final ProgressMonitor m) throws StatusException;
+
+}
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/.classpath b/eclient/org.eclipse.statet.rj.eclient.core/.classpath
index 7728a88..bdf43cd 100644
--- a/eclient/org.eclipse.statet.rj.eclient.core/.classpath
+++ b/eclient/org.eclipse.statet.rj.eclient.core/.classpath
@@ -10,6 +10,6 @@
<attribute name="annotationpath" value="/org.eclipse.statet/eea/"/>
</attributes>
</classpathentry>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="srcRSetups"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/META-INF/MANIFEST.MF b/eclient/org.eclipse.statet.rj.eclient.core/META-INF/MANIFEST.MF
index 5ba629b..a0ea338 100644
--- a/eclient/org.eclipse.statet.rj.eclient.core/META-INF/MANIFEST.MF
+++ b/eclient/org.eclipse.statet.rj.eclient.core/META-INF/MANIFEST.MF
@@ -8,6 +8,5 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.statet.rj.data;bundle-version="[4.0.0,4.1.0)";visibility:=reexport,
org.eclipse.statet.rj.services.core;bundle-version="[4.0.0,4.1.0)";visibility:=reexport,
- org.eclipse.statet.ecommons.runtime.core;bundle-version="4.0.0";visibility:=reexport
-Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0"
-Export-Package: org.eclipse.statet.rj.eclient.core;version="4.0.0"
+ org.eclipse.core.runtime;bundle-version="3.12.0";resolution:=optional
+Export-Package: org.eclipse.statet.rj.rsetups;version="4.0.0"
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/build.properties b/eclient/org.eclipse.statet.rj.eclient.core/build.properties
index 3240dd3..f2fc164 100644
--- a/eclient/org.eclipse.statet.rj.eclient.core/build.properties
+++ b/eclient/org.eclipse.statet.rj.eclient.core/build.properties
@@ -1,4 +1,4 @@
-source..= src/
+source..= srcRSetups/
output..= bin/
javacDefaultEncoding..= UTF-8
diff --git a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/AbstractRToolCommandHandler.java b/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/AbstractRToolCommandHandler.java
deleted file mode 100644
index 27e567a..0000000
--- a/eclient/org.eclipse.statet.rj.eclient.core/src/org/eclipse/statet/rj/eclient/core/AbstractRToolCommandHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*=============================================================================#
- # Copyright (c) 2012, 2018 Stephan Wahlbrink and others.
- #
- # This program and the accompanying materials are made available under the
- # terms of the Eclipse Public License 2.0 which is available at
- # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
- # which is available at https://www.apache.org/licenses/LICENSE-2.0.
- #
- # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
- #
- # Contributors:
- # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
- #=============================================================================*/
-
-package org.eclipse.statet.rj.eclient.core;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-
-import org.eclipse.statet.ecommons.ts.core.ToolCommandHandler;
-import org.eclipse.statet.ecommons.ts.core.ToolService;
-
-
-/**
- * @since 1.2
- */
-@NonNullByDefault
-public abstract class AbstractRToolCommandHandler implements ToolCommandHandler {
-
-
- @Override
- public IStatus execute(final String id, final ToolService service, final Map<String, Object> data,
- final IProgressMonitor monitor) throws CoreException {
- return execute(id, (RToolService) service, data, monitor);
- }
-
- protected abstract IStatus execute(String id, RToolService r, Map<String, Object> data,
- IProgressMonitor monitor) throws CoreException;
-
-}
diff --git a/core/org.eclipse.statet.rj.client/srcRSetups/org/eclipse/statet/rj/rsetups/RSetup.java b/eclient/org.eclipse.statet.rj.eclient.core/srcRSetups/org/eclipse/statet/rj/rsetups/RSetup.java
similarity index 100%
rename from core/org.eclipse.statet.rj.client/srcRSetups/org/eclipse/statet/rj/rsetups/RSetup.java
rename to eclient/org.eclipse.statet.rj.eclient.core/srcRSetups/org/eclipse/statet/rj/rsetups/RSetup.java
diff --git a/core/org.eclipse.statet.rj.client/srcRSetups/org/eclipse/statet/rj/rsetups/RSetupUtil.java b/eclient/org.eclipse.statet.rj.eclient.core/srcRSetups/org/eclipse/statet/rj/rsetups/RSetupUtil.java
similarity index 99%
rename from core/org.eclipse.statet.rj.client/srcRSetups/org/eclipse/statet/rj/rsetups/RSetupUtil.java
rename to eclient/org.eclipse.statet.rj.eclient.core/srcRSetups/org/eclipse/statet/rj/rsetups/RSetupUtil.java
index a6ea672..5c463af 100644
--- a/core/org.eclipse.statet.rj.client/srcRSetups/org/eclipse/statet/rj/rsetups/RSetupUtil.java
+++ b/eclient/org.eclipse.statet.rj.eclient.core/srcRSetups/org/eclipse/statet/rj/rsetups/RSetupUtil.java
@@ -61,7 +61,7 @@
/**
* Loads all available R setups for the current or the specified platform.
*
- * A filter map specifying a platform contains the arguments like <code>$os$</code> and
+ * A filter map specifying a platform contains the arguments like <code>$os$</code> and
* <code>$arch$</code> as keys; its values must be set to the known constant of the desired.
* platform.
*
@@ -90,7 +90,7 @@
/**
* Loads the R setup with the specified id for the current or the specified platform.
*
- * A filter map specifying a platform contains the arguments like <code>$os$</code> and
+ * A filter map specifying a platform contains the arguments like <code>$os$</code> and
* <code>$arch$</code> as keys; its values must be set to the known constant of the desired.
* platform.
*
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/META-INF/MANIFEST.MF b/eclient/org.eclipse.statet.rj.eclient.graphics/META-INF/MANIFEST.MF
index 9490b32..68a8211 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/META-INF/MANIFEST.MF
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/META-INF/MANIFEST.MF
@@ -9,14 +9,16 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.statet.rj.services.core;bundle-version="[4.0.0,4.1.0)",
org.eclipse.statet.rj.client;bundle-version="[4.0.0,4.1.0)",
- org.eclipse.statet.rj.eclient.core;bundle-version="[4.0.0,4.1.0)",
org.eclipse.core.runtime;bundle-version="3.15.0",
org.eclipse.ui;bundle-version="3.6.0",
org.eclipse.statet.ecommons.uimisc;bundle-version="[4.0.0,4.1.0)"
Import-Package: org.eclipse.statet.ecommons.collections;version="4.0.0",
org.eclipse.statet.ecommons.databinding,
org.eclipse.statet.jcommons.collections;version="4.0.0",
- org.eclipse.statet.jcommons.lang;version="4.0.0"
+ org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.runtime;version="4.0.0",
+ org.eclipse.statet.jcommons.status;version="4.0.0",
+ org.eclipse.statet.jcommons.ts.core;version="4.0.0"
Export-Package: org.eclipse.statet.rj.eclient.graphics,
org.eclipse.statet.rj.eclient.graphics.comclient,
org.eclipse.statet.rj.eclient.graphics.util
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/EclipseRGraphic.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/EclipseRGraphic.java
index 03aef27..eedc436 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/EclipseRGraphic.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/EclipseRGraphic.java
@@ -19,11 +19,7 @@
import java.util.List;
import java.util.concurrent.Callable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
@@ -33,14 +29,20 @@
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.Path;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.statet.jcommons.collections.CopyOnWriteIdentityListSet;
import org.eclipse.statet.jcommons.collections.ImCollections;
import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.runtime.CommonsRuntime;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.InfoStatus;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusChangeListener;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.status.Statuses;
+import org.eclipse.statet.jcommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.runtime.core.StatusChangeListener;
-import org.eclipse.statet.ecommons.ts.core.Tool;
import org.eclipse.statet.ecommons.ui.util.UIAccess;
import org.eclipse.statet.internal.rj.eclient.graphics.FontManager.FontFamily;
@@ -50,7 +52,6 @@
import org.eclipse.statet.rj.eclient.graphics.LocatorCallback;
import org.eclipse.statet.rj.eclient.graphics.RGraphics;
import org.eclipse.statet.rj.eclient.graphics.comclient.ToolRClientGraphicActions;
-import org.eclipse.statet.rj.eclient.graphics.util.CopyToDevRunnable;
import org.eclipse.statet.rj.graphic.core.RGraphicInitialization;
import org.eclipse.statet.rj.graphic.core.RGraphicInstruction;
import org.eclipse.statet.rj.graphic.core.util.CachedMapping;
@@ -123,8 +124,9 @@
}
catch (final SWTException e) {
if (e.code != SWT.ERROR_DEVICE_DISPOSED) {
- StatusManager.getManager().handle(new Status(IStatus.ERROR, RGraphics.BUNDLE_ID,
- "An error occurred when disposing SWT resources.", e ));
+ CommonsRuntime.log(new ErrorStatus(RGraphics.BUNDLE_ID,
+ "An error occurred when disposing SWT resources.",
+ e ));
}
}
}
@@ -356,14 +358,14 @@
private volatile LocatorCallback locatorCallback; // != null => started
private LocatorCallback locatorNotified;
- private IStatus locatorMessage;
+ private Status locatorMessage;
private Collection<String> locatorStopTypes= Collections.emptySet();
private double[] locatorLocationValue; // only used for R
private final Object locatorAnswerLock= new Object(); // pipe for answers
private final CopyOnWriteIdentityListSet<ERGraphic.Listener> graphicListeners= new CopyOnWriteIdentityListSet<>();
- private IStatus message= Status.OK_STATUS;
+ private Status message= Statuses.OK_STATUS;
private final CopyOnWriteIdentityListSet<StatusChangeListener> messageListeners= new CopyOnWriteIdentityListSet<>();
private boolean locatorNotificationDirectScheduled;
@@ -930,7 +932,8 @@
}
- protected void waitRUserExchange(final String type, final RService r, final IProgressMonitor monitor,
+ protected void waitRUserExchange(final String type,
+ final RService r, final ProgressMonitor m,
final Callable<Boolean> cancelListener) {
final RServiceControlExtension rControl= (r instanceof RServiceControlExtension) ?
(RServiceControlExtension) r : null;
@@ -945,7 +948,7 @@
this.userExchangeRCallback= null;
return;
}
- if (this.isLocalClosed || this.isRClosed || monitor.isCanceled() ) {
+ if (this.isLocalClosed || this.isRClosed || m.isCanceled() ) {
this.userExchangeRType= null;
this.userExchangeRCallback= null;
return;
@@ -954,7 +957,7 @@
}
if (rControl != null) {
- rControl.waitingForUser(monitor);
+ rControl.waitingForUser(m);
}
else {
try {
@@ -976,7 +979,7 @@
private void internalStartLocator(final LocatorCallback callback) {
this.locatorCallback= callback;
- this.locatorMessage= new Status(IStatus.INFO, RGraphics.BUNDLE_ID, callback.getMessage());
+ this.locatorMessage= new InfoStatus(RGraphics.BUNDLE_ID, callback.getMessage());
this.locatorStopTypes= callback.getStopTypes();
this.locatorDeferredStamp= Long.MIN_VALUE;
@@ -1016,7 +1019,7 @@
}
@Override
- public double[] runRLocator(final RService r, final IProgressMonitor monitor) {
+ public double[] runRLocator(final RService r, final ProgressMonitor m) {
synchronized (this.userExchangeLock) {
if (this.locatorCallback != null && this.locatorCallback != R_LOCATOR_CALLBACK) {
return null;
@@ -1026,7 +1029,7 @@
this.locatorLocationValue= null;
}
- waitRUserExchange("locator", r, monitor, new Callable<Boolean>() {
+ waitRUserExchange("locator", r, m, new Callable<Boolean>() {
@Override
public Boolean call() {
return Boolean.valueOf(answerLocator(null, null, true));
@@ -1045,17 +1048,17 @@
}
@Override
- public IStatus startLocalLocator(final LocatorCallback callback) {
+ public Status startLocalLocator(final LocatorCallback callback) {
if (callback == null) {
throw new NullPointerException("callback"); //$NON-NLS-1$
}
synchronized (this.userExchangeLock) {
if (this.locatorCallback != null && this.locatorCallback != callback) {
- return new Status(IStatus.ERROR, RGraphics.BUNDLE_ID, "Another locator is already started.");
+ return new ErrorStatus(RGraphics.BUNDLE_ID, "Another locator is already started.");
}
internalStartLocator(callback);
}
- return Status.OK_STATUS;
+ return Statuses.OK_STATUS;
}
@Override
@@ -1196,7 +1199,7 @@
}
@Override
- public IStatus resize(final double w, final double h) {
+ public Status resize(final double w, final double h) {
if (this.actions != null) {
this.nextSize= new double[] { w, h };
return this.actions.resizeGraphic(this.devId, new Runnable() {
@@ -1210,7 +1213,7 @@
}
@Override
- public IStatus close() {
+ public Status close() {
if (this.isRClosed) {
this.isLocalClosed= true;
dispose();
@@ -1239,23 +1242,23 @@
}
protected void updateMessage() {
- IStatus message;
+ Status message;
if (this.locatorMessage != null) {
message= this.locatorMessage;
}
else {
- message= Status.OK_STATUS;
+ message= Statuses.OK_STATUS;
}
if (!this.message.equals(message)) {
this.message= message;
for (final StatusChangeListener listener : this.messageListeners.toList()) {
- listener.statusChanged(message);
+ listener.onStatusChanged(message);
}
}
}
@Override
- public IStatus getMessage() {
+ public Status getMessage() {
return this.message;
}
@@ -1270,43 +1273,35 @@
}
- protected void preAction() throws CoreException {
+ protected void preAction() throws StatusException {
if (this.actions == null || this.actions.getRHandle() == null) {
throw new UnsupportedOperationException();
}
if (this.isRClosed) {
- throw new CoreException(new Status(IStatus.ERROR, RGraphics.BUNDLE_ID,
+ throw new StatusException(new ErrorStatus(RGraphics.BUNDLE_ID,
"The R graphic device is already closed." ));
}
}
- @Deprecated
- public IStatus copy(final String toDev, final String toDevFile, final String toDevArgs)
- throws CoreException {
- preAction();
- return this.actions.getRHandle().getQueue().add(new CopyToDevRunnable(this,
- toDev, toDevFile, toDevArgs ));
- }
-
@Override
public void copy(final String toDev, final String toDevFile, final String toDevArgs,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
preAction();
- this.actions.copy(this.devId, toDev, toDevFile, toDevArgs, monitor);
+ this.actions.copy(this.devId, toDev, toDevFile, toDevArgs, m);
}
@Override
public double[] convertGraphic2User(final double[] xy,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
preAction();
- return this.actions.convertGraphic2User(this.devId, xy, monitor);
+ return this.actions.convertGraphic2User(this.devId, xy, m);
}
@Override
public double[] convertUser2Graphic(final double[] xy,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
preAction();
- return this.actions.convertUser2Graphic(this.devId, xy, monitor);
+ return this.actions.convertUser2Graphic(this.devId, xy, m);
}
}
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/RGraphicsPlugin.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/RGraphicsPlugin.java
index 7c1600f..c3eb4e4 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/RGraphicsPlugin.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/internal/rj/eclient/graphics/RGraphicsPlugin.java
@@ -22,6 +22,7 @@
import org.osgi.framework.BundleContext;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -52,11 +53,19 @@
*
* @return the shared instance
*/
- public static RGraphicsPlugin getDefault() {
+ public static RGraphicsPlugin getInstance() {
return instance;
}
+ public static final void log(final IStatus status) {
+ final Plugin plugin= getInstance();
+ if (plugin != null) {
+ plugin.getLog().log(status);
+ }
+ }
+
+
private boolean started;
private final List<Disposable> disposables= new ArrayList<>();
@@ -85,8 +94,9 @@
listener.dispose();
}
catch (final Throwable e) {
- getLog().log(new Status(IStatus.ERROR, RGraphics.BUNDLE_ID, 0,
- "Error occured when dispose module", e ));
+ log(new Status(IStatus.ERROR, RGraphics.BUNDLE_ID,
+ "Error occured when dispose module", //$NON-NLS-1$
+ e ));
}
}
this.disposables.clear();
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/ERGraphic.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/ERGraphic.java
index 0073b5e..bc16312 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/ERGraphic.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/ERGraphic.java
@@ -17,14 +17,12 @@
import java.util.Collection;
import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
import org.eclipse.statet.jcommons.lang.Nullable;
-
-import org.eclipse.statet.ecommons.runtime.core.StatusChangeListener;
-import org.eclipse.statet.ecommons.ts.core.Tool;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusChangeListener;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.Tool;
import org.eclipse.statet.rj.graphic.core.RGraphic;
@@ -87,7 +85,7 @@
*/
interface ListenerInstructionsExtension extends Listener {
- void instructionsChanged(boolean reset, List<ERGraphicInstruction> added);
+ void instructionsChanged(final boolean reset, final List<ERGraphicInstruction> added);
}
@@ -113,15 +111,15 @@
@Override
List<? extends ERGraphicInstruction> getInstructions();
- IStatus resize(double w, double h);
+ Status resize(final double w, final double h);
- IStatus close();
+ Status close();
/**
* Returns the current message for the graphic.
* <p>
* The standard OK message means there is no message. If the message changes messages listeners
- * registered for this graphic ({@link #addMessageListener(StatusChangeListener)},
+ * registered for this graphic ({@link #addMessageListener(StatusChangeListener)},
* {@link #removeMessageListener(StatusChangeListener)}) are notified.</p>
* <p>
* The message I can be shown for example in the status line of the application.</p>
@@ -129,7 +127,7 @@
* @return the current message to show
* @since 1.0
*/
- IStatus getMessage();
+ Status getMessage();
/**
* Registers a new message listener for this graphic.
@@ -137,7 +135,7 @@
* @param listener the listener to add
* @since 1.0
*/
- void addMessageListener(StatusChangeListener listener);
+ void addMessageListener(final StatusChangeListener listener);
/**
* Removes a message listener registered for this graphic.
@@ -145,31 +143,31 @@
* @param listener the listener to remove
* @since 1.0
*/
- void removeMessageListener(StatusChangeListener listener);
+ void removeMessageListener(final StatusChangeListener listener);
/**
* Starts a local locator requesting the user to select a point in the graphic.
* <p>
* The method starts the locator and returns directly; it does not wait for an answer.
- * If a locator is already installed for this graphic (local or from R), the method does
+ * If a locator is already installed for this graphic (local or from R), the method does
* nothing and returns an error status.</p>
* <p>
* The locator callback configures the request and receives the answer(s). The answer can be
- * a coordinate located by the user ({@link LocatorCallback#located(double, double)}) or
+ * a coordinate located by the user ({@link LocatorCallback#located(double, double)}) or
* a stop command ({@link LocatorCallback#stopped(String)}.</p>
* <p>
* Graphic listeners implementing {@link ListenerLocatorExtension} and registered for this
- * graphic ({@link #addListener(Listener)}, {@link #removeListener(Listener)}) are notified
+ * graphic ({@link #addListener(Listener)}, {@link #removeListener(Listener)}) are notified
* if the locator is started and if it is finally stopped.</p>
*
* @param callback the callback called to handover the answer(s)
- * @return An OK status if the locator is started for the given callback, otherwise
+ * @return An OK status if the locator is started for the given callback, otherwise
* an error status
* @see LocatorCallback
* @since 1.0
*/
- IStatus startLocalLocator(LocatorCallback callback);
+ Status startLocalLocator(final LocatorCallback callback);
/**
* Returns true if any locator (local or from R) is started for this graphic.
@@ -199,7 +197,7 @@
* @param y the y value of the graphic coordinate
* @since 1.0
*/
- void returnLocator(double x, double y);
+ void returnLocator(final double x, final double y);
/**
* Answers a locator request with the specified stop command.
@@ -210,55 +208,55 @@
* @see LocatorCallback#getStopTypes()
* @since 1.0
*/
- void stopLocator(String type);
+ void stopLocator(final String type);
/**
* Copies the graphic to another R graphic device.
* <p>
- * This is an R based function. The caller must have exclusive access to the R service. The
+ * This is an R based function. The caller must have exclusive access to the R service. The
* graphic must be available in R.</p>
*
* @param toDev the name of the target device
* @param toDevFile the name of the file for file based devices
* @param toDevArgs other R arguments for the target arguments
- * @param monitor
- * @throws CoreException
+ * @param m
+ * @throws StatusException
* @since 1.0
*/
- void copy(String toDev, String toDevFile, String toDevArgs,
- IProgressMonitor monitor) throws CoreException;
+ void copy(final String toDev, final String toDevFile, final String toDevArgs,
+ final ProgressMonitor m) throws StatusException;
/**
* Converts a coordinate (x, y) from graphic to user coordinate system.
* <p>
- * This is an R based function. The caller must have exclusive access to the R service. The
+ * This is an R based function. The caller must have exclusive access to the R service. The
* graphic must be available in R.</p>
*
* @param xy the graphic coordinate to convert
- * @param monitor
+ * @param m
* @return the converted user coordinate
- * @throws CoreException
+ * @throws StatusException
* @see ERGraphic coordinate systems
* @since 1.0
*/
- double[] convertGraphic2User(double[] xy,
- IProgressMonitor monitor) throws CoreException;
+ double[] convertGraphic2User(final double[] xy,
+ final ProgressMonitor m) throws StatusException;
/**
* Converts a coordinate (x, y) from user to graphic coordinate system.
* <p>
- * This is an R based function. The caller must have exclusive access to the R service. The
+ * This is an R based function. The caller must have exclusive access to the R service. The
* graphic must be available in R.</p>
*
* @param xy the graphic coordinate to convert
- * @param monitor
+ * @param m
* @return the converted user coordinate
- * @throws CoreException
+ * @throws StatusException
* @see ERGraphic coordinate systems
* @since 1.0
*/
- double[] convertUser2Graphic(double[] xy,
- IProgressMonitor monitor) throws CoreException;
+ double[] convertUser2Graphic(final double[] xy,
+ final ProgressMonitor m) throws StatusException;
}
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/PageBookRGraphicView.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/PageBookRGraphicView.java
index ab33e7f..936272e 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/PageBookRGraphicView.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/PageBookRGraphicView.java
@@ -25,9 +25,7 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler2;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -52,8 +50,11 @@
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.ts.core.Tool;
import org.eclipse.statet.ecommons.ui.SharedUIResources;
import org.eclipse.statet.ecommons.ui.actions.HandlerCollection;
import org.eclipse.statet.ecommons.ui.actions.HandlerContributionItem;
@@ -63,8 +64,8 @@
import org.eclipse.statet.ecommons.ui.util.UIAccess;
import org.eclipse.statet.ecommons.ui.workbench.ContextHandlers;
-import org.eclipse.statet.rj.eclient.core.AbstractRToolRunnable;
-import org.eclipse.statet.rj.eclient.core.RToolService;
+import org.eclipse.statet.rj.ts.core.AbstractRToolRunnable;
+import org.eclipse.statet.rj.ts.core.RToolService;
/**
@@ -150,8 +151,10 @@
page.showView(this.viewId, secondaryId, IWorkbenchPage.VIEW_VISIBLE );
}
catch (final PartInitException e) {
- StatusManager.getManager().handle(new Status(IStatus.ERROR, RGraphics.BUNDLE_ID,
- "An error occurred when opening a new R Graphics view.", e ));
+ StatusManager.getManager().handle(new org.eclipse.core.runtime.Status(
+ IStatus.ERROR, RGraphics.BUNDLE_ID,
+ "An error occurred when opening a new R Graphics view.",
+ e ));
}
finally {
newViewGraphic= null;
@@ -192,8 +195,8 @@
@Override
public void run(final RToolService r,
- final IProgressMonitor monitor) throws CoreException {
- r.evalVoid("rj.gd::rj.GD()", monitor); //$NON-NLS-1$
+ final ProgressMonitor m) throws StatusException {
+ r.evalVoid("rj.gd::rj.GD()", m); //$NON-NLS-1$
}
});
@@ -201,8 +204,10 @@
}
catch (final CoreException e) {
if (e.getStatus().getSeverity() != IStatus.CANCEL) {
- StatusManager.getManager().handle(new Status(IStatus.ERROR, RGraphics.BUNDLE_ID, -1,
- "An error occurrend when creating a new graphic device.", e),
+ StatusManager.getManager().handle(new org.eclipse.core.runtime.Status(
+ IStatus.ERROR, RGraphics.BUNDLE_ID,
+ "An error occurrend when creating a new graphic device.",
+ e ),
StatusManager.LOG | StatusManager.SHOW);
}
}
@@ -258,8 +263,10 @@
secondaryId, IWorkbenchPage.VIEW_ACTIVATE );
}
catch (final PartInitException e) {
- StatusManager.getManager().handle(new Status(IStatus.ERROR, RGraphics.BUNDLE_ID, -1,
- "An error occurred when opening an additional R graphics view.", e));
+ StatusManager.getManager().handle(new org.eclipse.core.runtime.Status(
+ IStatus.ERROR, RGraphics.BUNDLE_ID,
+ "An error occurred when opening an additional R graphics view.",
+ e ));
}
return null;
}
@@ -505,8 +512,8 @@
@Override
public void closePage(final RGraphicSession session) {
- final IStatus status= session.getGraphic().close();
- if (status != null && status.getSeverity() < IStatus.ERROR) {
+ final Status status= session.getGraphic().close();
+ if (status != null && status.getSeverity() < Status.ERROR) {
return;
}
super.closePage(session);
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicCompositeActionSet.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicCompositeActionSet.java
index 43bed8e..c0e3337 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicCompositeActionSet.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicCompositeActionSet.java
@@ -24,9 +24,6 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler2;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -42,17 +39,20 @@
import org.eclipse.statet.jcommons.collections.CopyOnWriteIdentityListSet;
import org.eclipse.statet.jcommons.collections.ImIdentityList;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.SystemRunnable;
+import org.eclipse.statet.jcommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.ts.core.SystemRunnable;
-import org.eclipse.statet.ecommons.ts.core.Tool;
import org.eclipse.statet.ecommons.ui.SharedUIResources;
import org.eclipse.statet.ecommons.ui.actions.HandlerCollection;
import org.eclipse.statet.ecommons.ui.actions.HandlerContributionItem;
import org.eclipse.statet.internal.rj.eclient.graphics.RGraphicsPlugin;
-import org.eclipse.statet.rj.eclient.core.AbstractRToolRunnable;
-import org.eclipse.statet.rj.eclient.core.RToolService;
import org.eclipse.statet.rj.eclient.graphics.util.AbstractLocalLocator;
+import org.eclipse.statet.rj.ts.core.AbstractRToolRunnable;
+import org.eclipse.statet.rj.ts.core.RToolService;
/**
@@ -96,8 +96,8 @@
return null;
}
final double[] size= RGraphicCompositeActionSet.this.graphicComposite.getGraphicFitSize();
- final IStatus status= RGraphicCompositeActionSet.this.graphic.resize(size[0], size[1]);
- if (status == null || !status.isOK()) {
+ final Status status= RGraphicCompositeActionSet.this.graphic.resize(size[0], size[1]);
+ if (status == null || status.getSeverity() != Status.OK) {
// TODO: Status message
Display.getCurrent().beep();
}
@@ -155,8 +155,8 @@
if (this.scheduled) {
return true;
}
- final IStatus status= this.graphic.getRHandle().getQueue().addHot(this);
- if (status.isOK()) {
+ final Status status= this.graphic.getRHandle().getQueue().addHot(this);
+ if (status.getSeverity() == Status.OK) {
this.scheduled= true;
return true;
}
@@ -202,7 +202,7 @@
@Override
protected void run(final RToolService service,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
double[] source= null;
double[] target= null;
while (true) {
@@ -217,7 +217,7 @@
}
this.todoSource= null;
}
- target= this.graphic.convertGraphic2User(source, monitor);
+ target= this.graphic.convertGraphic2User(source, m);
}
}
@@ -250,7 +250,8 @@
}
});
if (RGraphicCompositeActionSet.this.mouseLocationRunnable == null) {
- RGraphicCompositeActionSet.this.mouseLocationRunnable= new ConversionRunnable(RGraphicCompositeActionSet.this.graphic) {
+ RGraphicCompositeActionSet.this.mouseLocationRunnable= new ConversionRunnable(
+ RGraphicCompositeActionSet.this.graphic) {
@Override
protected void converted(final ERGraphic graphic,
final double[] source, final double[] target) {
@@ -336,7 +337,7 @@
toolBar.insertBefore(ADDITIONS_GROUP_ID, new Separator(SIZE_MENU_GROUP_ID));
}
- final ImageRegistry rGraphicsImageRegistry= RGraphicsPlugin.getDefault().getImageRegistry();
+ final ImageRegistry rGraphicsImageRegistry= RGraphicsPlugin.getInstance().getImageRegistry();
toolBar.appendToGroup(CONTEXT_MENU_GROUP_ID, new HandlerContributionItem(new CommandContributionItemParameter(
serviceLocator, null, HandlerContributionItem.NO_COMMAND_ID, null,
@@ -397,7 +398,7 @@
protected void addSizeActions(final IServiceLocator serviceLocator, final IActionBars actionBars) {
final IToolBarManager toolBar= actionBars.getToolBarManager();
- final ImageRegistry rGraphicsImageRegistry= RGraphicsPlugin.getDefault().getImageRegistry();
+ final ImageRegistry rGraphicsImageRegistry= RGraphicsPlugin.getInstance().getImageRegistry();
toolBar.appendToGroup(SIZE_MENU_GROUP_ID, new HandlerContributionItem(new CommandContributionItemParameter(
serviceLocator, null, HandlerContributionItem.NO_COMMAND_ID, null,
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicPage.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicPage.java
index 36db775..423c3e9 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicPage.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/RGraphicPage.java
@@ -24,7 +24,6 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler2;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.StatusLineContributionItem;
@@ -36,7 +35,9 @@
import org.eclipse.ui.part.Page;
import org.eclipse.ui.services.IServiceLocator;
-import org.eclipse.statet.ecommons.runtime.core.StatusChangeListener;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusChangeListener;
+
import org.eclipse.statet.ecommons.ui.util.UIAccess;
import org.eclipse.statet.rj.eclient.graphics.RGraphicCompositeActionSet.LocationListener;
@@ -79,7 +80,7 @@
initActions(getSite(), getSite().getActionBars());
this.graphic.addMessageListener(this);
- statusChanged(this.graphic.getMessage());
+ onStatusChanged(this.graphic.getMessage());
}
protected void initActions(final IServiceLocator serviceLocator, final IActionBars actionBars) {
@@ -146,7 +147,7 @@
}
@Override
- public void statusChanged(final IStatus status) {
+ public void onStatusChanged(final Status status) {
final String message;
if (status.getSeverity() > 0) {
message= status.getMessage();
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActions.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActions.java
index 9840d12..ca21726 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActions.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActions.java
@@ -14,32 +14,33 @@
package org.eclipse.statet.rj.eclient.graphics.comclient;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.status.Statuses;
+import org.eclipse.statet.jcommons.ts.core.SystemRunnable;
+import org.eclipse.statet.jcommons.ts.core.Tool;
import org.eclipse.statet.ecommons.collections.IntArrayMap;
-import org.eclipse.statet.ecommons.ts.core.SystemRunnable;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-import org.eclipse.statet.rj.eclient.core.AbstractRToolRunnable;
-import org.eclipse.statet.rj.eclient.core.RToolService;
import org.eclipse.statet.rj.server.client.AbstractRJComClient;
import org.eclipse.statet.rj.server.client.AbstractRJComClientGraphicActions;
+import org.eclipse.statet.rj.ts.core.AbstractRToolRunnable;
+import org.eclipse.statet.rj.ts.core.RTool;
+import org.eclipse.statet.rj.ts.core.RToolService;
public class ERClientGraphicActions extends AbstractRJComClientGraphicActions
implements ToolRClientGraphicActions {
- private final Tool tool;
+ private final RTool tool;
private final IntArrayMap<Boolean> resizeTasks= new IntArrayMap<>();
private final IntArrayMap<Boolean> closeTasks= new IntArrayMap<>();
- public ERClientGraphicActions(final AbstractRJComClient rjs, final Tool tool) {
+ public ERClientGraphicActions(final AbstractRJComClient rjs, final RTool tool) {
super(rjs);
this.tool= tool;
}
@@ -73,13 +74,12 @@
}
@Override
- public void run(final RToolService r,
- final IProgressMonitor monitor) throws CoreException {
+ public void run(final RToolService r, final ProgressMonitor m) throws StatusException {
synchronized (ERClientGraphicActions.this.closeTasks) {
ERClientGraphicActions.this.resizeTasks.put(this.devId, Boolean.FALSE);
}
this.beforeResize.run();
- doResizeGraphic(this.devId, monitor);
+ doResizeGraphic(this.devId, m);
}
}
@@ -114,39 +114,38 @@
}
@Override
- public void run(final RToolService r,
- final IProgressMonitor monitor) throws CoreException {
- doCloseGraphic(this.devId, monitor);
+ public void run(final RToolService r, final ProgressMonitor m) throws StatusException {
+ doCloseGraphic(this.devId, m);
}
}
@Override
- public Tool getRHandle() {
+ public RTool getRHandle() {
return this.tool;
}
@Override
public String getRLabel() {
- return this.tool.getLabel(Tool.DEFAULT_LABEL);
+ return this.tool.getLabel(RTool.DEFAULT_LABEL);
}
@Override
- public IStatus resizeGraphic(final int devId, final Runnable beforeResize) {
+ public Status resizeGraphic(final int devId, final Runnable beforeResize) {
synchronized (this.resizeTasks) {
if (this.resizeTasks.put(devId, Boolean.TRUE) == Boolean.TRUE) {
- return Status.OK_STATUS;
+ return Statuses.OK_STATUS;
}
}
return this.tool.getQueue().add(new ResizeRunnable(devId, beforeResize));
}
@Override
- public IStatus closeGraphic(final int devId) {
+ public Status closeGraphic(final int devId) {
synchronized (this.closeTasks) {
if (this.closeTasks.put(devId, Boolean.TRUE) == Boolean.TRUE) {
- return Status.OK_STATUS;
+ return Statuses.OK_STATUS;
}
}
return this.tool.getQueue().add(new CloseRunnable(devId));
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActionsFactory.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActionsFactory.java
index 759be8d..83e2f92 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActionsFactory.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ERClientGraphicActionsFactory.java
@@ -14,10 +14,9 @@
package org.eclipse.statet.rj.eclient.graphics.comclient;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-
import org.eclipse.statet.rj.server.client.AbstractRJComClient;
import org.eclipse.statet.rj.server.client.AbstractRJComClientGraphicActions;
+import org.eclipse.statet.rj.ts.core.RTool;
public class ERClientGraphicActionsFactory implements AbstractRJComClientGraphicActions.Factory {
@@ -25,8 +24,8 @@
@Override
public AbstractRJComClientGraphicActions create(final AbstractRJComClient rjs, final Object rHandle) {
- if (rHandle instanceof Tool) {
- return new ERClientGraphicActions(rjs, (Tool) rHandle);
+ if (rHandle instanceof RTool) {
+ return new ERClientGraphicActions(rjs, (RTool) rHandle);
}
return null;
}
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ToolRClientGraphicActions.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ToolRClientGraphicActions.java
index fe035ff..7637658 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ToolRClientGraphicActions.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/comclient/ToolRClientGraphicActions.java
@@ -14,15 +14,14 @@
package org.eclipse.statet.rj.eclient.graphics.comclient;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-
import org.eclipse.statet.rj.server.client.RClientGraphicActions;
+import org.eclipse.statet.rj.ts.core.RTool;
public interface ToolRClientGraphicActions extends RClientGraphicActions {
@Override
- Tool getRHandle();
+ RTool getRHandle();
}
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/AbstractLocalLocator.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/AbstractLocalLocator.java
index a8134ad..22abecc 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/AbstractLocalLocator.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/AbstractLocalLocator.java
@@ -18,15 +18,14 @@
import java.util.Collection;
import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
import org.eclipse.statet.jcommons.collections.ImCollections;
import org.eclipse.statet.jcommons.collections.ImList;
-
-import org.eclipse.statet.ecommons.ts.core.SystemRunnable;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.ts.core.ToolService;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.SystemRunnable;
+import org.eclipse.statet.jcommons.ts.core.Tool;
+import org.eclipse.statet.jcommons.ts.core.ToolService;
import org.eclipse.statet.rj.eclient.graphics.ERGraphic;
import org.eclipse.statet.rj.eclient.graphics.LocatorCallback;
@@ -36,7 +35,7 @@
* Basic implementation for a local locator for R graphics.
* <p>
* Requests the user to locate point and converts the graphic coordinates to user coordinates.
- * It uses the tool service API (org.eclipse.statet.ecommons.ts.core) to schedule the R job.</p>
+ * It uses the tool service API (org.eclipse.statet.jcommons.ts.core) to schedule the R job.</p>
*/
public abstract class AbstractLocalLocator extends LocatorCallback implements SystemRunnable {
@@ -151,8 +150,7 @@
}
@Override
- public void run(final ToolService service,
- final IProgressMonitor monitor) throws CoreException {
+ public void run(final ToolService service, final ProgressMonitor m) throws StatusException {
double[] graphic= null;
double[] user= null;
while (true) {
@@ -174,7 +172,7 @@
graphic= this.toConvert.remove(0);
user= null;
}
- user= this.graphic.convertGraphic2User(graphic, monitor);
+ user= this.graphic.convertGraphic2User(graphic, m);
}
}
@@ -183,7 +181,7 @@
*/
protected boolean internalScheduleConversion() {
if (!this.runnableScheduled) {
- if (this.tool.getQueue().addHot(this).isOK()) {
+ if (this.tool.getQueue().addHot(this).getSeverity() == Status.OK) {
this.runnableScheduled= true;
return true;
}
@@ -223,7 +221,7 @@
this.locatedUser.clear();
this.started= this.graphicLocatorStarted= true;
this.counter= 0;
- if (this.graphic.startLocalLocator(this).isOK()) {
+ if (this.graphic.startLocalLocator(this).getSeverity() == Status.OK) {
return true;
}
else {
diff --git a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/CopyToDevRunnable.java b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/CopyToDevRunnable.java
index 7049292..27dede9 100644
--- a/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/CopyToDevRunnable.java
+++ b/eclient/org.eclipse.statet.rj.eclient.graphics/src/org/eclipse/statet/rj/eclient/graphics/util/CopyToDevRunnable.java
@@ -14,14 +14,13 @@
package org.eclipse.statet.rj.eclient.graphics.util;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-
-import org.eclipse.statet.rj.eclient.core.AbstractRToolRunnable;
-import org.eclipse.statet.rj.eclient.core.RToolService;
import org.eclipse.statet.rj.eclient.graphics.ERGraphic;
+import org.eclipse.statet.rj.ts.core.AbstractRToolRunnable;
+import org.eclipse.statet.rj.ts.core.RToolService;
public class CopyToDevRunnable extends AbstractRToolRunnable {
@@ -53,9 +52,8 @@
}
@Override
- public void run(final RToolService r,
- final IProgressMonitor monitor) throws CoreException {
- this.graphic.copy(this.toDev, this.toDevFile, this.toDevArgs, monitor);
+ public void run(final RToolService r, final ProgressMonitor m) throws StatusException {
+ this.graphic.copy(this.toDev, this.toDevFile, this.toDevArgs, m);
}
}
diff --git a/examples/org.eclipse.statet.rj.example.demo/META-INF/MANIFEST.MF b/examples/org.eclipse.statet.rj.example.demo/META-INF/MANIFEST.MF
index 7a75a64..4f4d9ab 100644
--- a/examples/org.eclipse.statet.rj.example.demo/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.statet.rj.example.demo/META-INF/MANIFEST.MF
@@ -7,6 +7,7 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.statet.rj.data;bundle-version="[4.0.0,4.1.0)",
org.eclipse.statet.rj.servi;bundle-version="[4.0.0,4.1.0)",
- org.eclipse.statet.ecommons.runtime.core;bundle-version="4.0.0",
org.eclipse.swt;bundle-version="3.4.0"
-Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0"
+Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.runtime;version="4.0.0",
+ org.eclipse.statet.jcommons.status;version="4.0.0"
diff --git a/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/DemoApp.java b/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/DemoApp.java
index 85ebb39..43657bc 100644
--- a/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/DemoApp.java
+++ b/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/DemoApp.java
@@ -47,7 +47,7 @@
import org.eclipse.statet.rj.data.RObject;
import org.eclipse.statet.rj.servi.RServi;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
import org.eclipse.statet.rj.services.FunctionCall;
import org.eclipse.statet.rj.services.util.Graphic;
import org.eclipse.statet.rj.services.util.PngGraphic;
@@ -454,7 +454,7 @@
fLogText.setText("");
fLogText.append("Requesting RServi instance...");
try {
- fRServi= RServiUtil.getRServi(fInitRemoteText.getText(), "demo/test");
+ fRServi= RServiUtils.getRServi(fInitRemoteText.getText(), "demo/test");
logOK();
}
catch (Exception e) {
diff --git a/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/EAppEnvSWT.java b/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/EAppEnvSWT.java
index 8af95a2..73aca78 100644
--- a/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/EAppEnvSWT.java
+++ b/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/EAppEnvSWT.java
@@ -16,51 +16,58 @@
import java.util.concurrent.CopyOnWriteArraySet;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.statet.jcommons.lang.Disposable;
-
-import org.eclipse.statet.ecommons.runtime.core.ECommonsRuntime;
+import org.eclipse.statet.jcommons.runtime.AppEnvironment;
+import org.eclipse.statet.jcommons.runtime.CommonsRuntime;
+import org.eclipse.statet.jcommons.status.Status;
/** Replaces missing Eclipse environment */
-public class EAppEnvSWT implements ECommonsRuntime.AppEnvironment, DisposeListener {
+public class EAppEnvSWT implements AppEnvironment, DisposeListener {
private final CopyOnWriteArraySet<Disposable> stopListeners= new CopyOnWriteArraySet<>();
public EAppEnvSWT() {
- ECommonsRuntime.init("org.eclipse.statet.rj.services.eruntime", this);
+ CommonsRuntime.init(this);
+ }
+
+
+ @Override
+ public String getBundleId() {
+ return "org.eclipse.statet.rj.servi.demo";
+ }
+
+ @Override
+ public void log(Status status) {
+ System.out.println(status.toString());
}
@Override
public void addStoppingListener(Disposable listener) {
- stopListeners.add(listener);
+ this.stopListeners.add(listener);
}
@Override
public void removeStoppingListener(Disposable listener) {
- stopListeners.add(listener);
+ this.stopListeners.add(listener);
}
- @Override
- public void log(IStatus status) {
- System.out.println(status.toString());
- }
@Override
public void widgetDisposed(DisposeEvent e) {
try {
- for (final Disposable listener : stopListeners) {
+ for (final Disposable listener : this.stopListeners) {
listener.dispose();
}
}
finally {
- stopListeners.clear();
+ this.stopListeners.clear();
}
}
diff --git a/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/more/CorrelationPlotter.java b/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/more/CorrelationPlotter.java
index 926c9c2..023daf7 100644
--- a/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/more/CorrelationPlotter.java
+++ b/examples/org.eclipse.statet.rj.example.demo/src/org/eclipse/statet/rj/example/demo/more/CorrelationPlotter.java
@@ -35,7 +35,7 @@
import org.eclipse.statet.rj.data.RObject;
import org.eclipse.statet.rj.example.demo.EAppEnvSWT;
import org.eclipse.statet.rj.servi.RServi;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
import org.eclipse.statet.rj.services.FunctionCall;
import org.eclipse.statet.rj.services.util.Graphic;
import org.eclipse.statet.rj.services.util.PngGraphic;
@@ -175,7 +175,7 @@
String URL= "rmi://127.0.0.1/rservi-pool";
try {
- fRservi= RServiUtil.getRServi(URL, "CorrelationPlotter");
+ fRservi= RServiUtils.getRServi(URL, "CorrelationPlotter");
} catch (Exception e1) {
e1.printStackTrace();
}
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo1/META-INF/MANIFEST.MF b/examples/org.eclipse.statet.rj.example.rcpdemo1/META-INF/MANIFEST.MF
index 09d1eb0..4e5857a 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo1/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo1/META-INF/MANIFEST.MF
@@ -7,12 +7,15 @@
Bundle-Activator: org.eclipse.statet.internal.rj.example.rcpdemo.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.statet.ecommons.rmi.core;bundle-version="4.0.0",
+Require-Bundle: org.eclipse.statet.ecommons.runtime.core;bundle-version="4.0.0",
+ org.eclipse.core.runtime,
org.eclipse.statet.rj.data;bundle-version="4.0.0",
org.eclipse.statet.rj.server;bundle-version="4.0.0",
org.eclipse.statet.rj.client;bundle-version="4.0.0",
org.eclipse.statet.rj.servi;bundle-version="4.0.0",
org.eclipse.ui,
+ org.eclipse.statet.rj.eclient.core;bundle-version="4.0.0",
org.eclipse.statet.rj.eclient.graphics;bundle-version="4.0.0"
-Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0"
+Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.rmi;version="4.0.0",
+ org.eclipse.statet.jcommons.status;version="4.0.0"
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java
index 6487b00..e60d256 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java
@@ -14,8 +14,6 @@
package org.eclipse.statet.internal.rj.example.rcpdemo.views;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -29,6 +27,9 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
+
import org.eclipse.statet.rj.eclient.graphics.ERGraphic;
import org.eclipse.statet.rj.eclient.graphics.RGraphicComposite;
import org.eclipse.statet.rj.example.rcpdemo.RJob;
@@ -117,14 +118,14 @@
final RJob job= new RJob("GraphDemo") {
@Override
protected void runRTask(final RService r,
- final IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Creating graphic in R...", 100);
+ final ProgressMonitor m) throws StatusException {
+ m.beginTask("Creating graphic in R...", 100);
final RGraphicCreator rGraphicCreator= r.createRGraphicCreator(0);
rGraphicCreator.setSize(size.x, size.y);
- final RGraphic plot= rGraphicCreator.create(command, monitor);
+ final RGraphic plot= rGraphicCreator.create(command, m);
- monitor.worked(90);
+ m.addWorked(90);
if (plot instanceof ERGraphic) {
final ERGraphic erPlot= (ERGraphic) plot;
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java
index dab2c69..d828726 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java
@@ -14,7 +14,6 @@
package org.eclipse.statet.internal.rj.example.rcpdemo.views;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
@@ -30,6 +29,8 @@
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.statet.jcommons.status.StatusException;
+
import org.eclipse.statet.internal.rj.example.rcpdemo.Activator;
import org.eclipse.statet.rj.example.rcpdemo.RServiManager;
@@ -143,7 +144,7 @@
return;
}
}
- catch (final CoreException e) {
+ catch (final StatusException e) {
StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID,
"Could not apply RServi configuration.", e),
StatusManager.SHOW | StatusManager.LOG);
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RJob.java b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RJob.java
index 88b8522..0687872 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RJob.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RJob.java
@@ -14,12 +14,16 @@
package org.eclipse.statet.rj.example.rcpdemo;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
+
+import org.eclipse.statet.ecommons.runtime.core.util.StatusUtils;
+
import org.eclipse.statet.internal.rj.example.rcpdemo.Activator;
import org.eclipse.statet.rj.servi.RServi;
import org.eclipse.statet.rj.services.RService;
@@ -40,12 +44,13 @@
@Override
protected IStatus run(final IProgressMonitor monitor) {
+ final ProgressMonitor m= StatusUtils.convert(monitor, 1);
RServi servi= null;
try {
servi= this.rServiManager.getRServi(getName());
- runRTask(servi, monitor);
+ runRTask(servi, m);
}
- catch (final CoreException e) {
+ catch (final StatusException e) {
return new Status(IStatus.ERROR, Activator.BUNDLE_ID,
"An error occurred when running " + getName() + ".", e);
}
@@ -53,7 +58,7 @@
if (servi != null) {
try {
servi.close();
- } catch (final CoreException e) {
+ } catch (final StatusException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -67,6 +72,6 @@
return this.rServiManager == family;
}
- protected abstract void runRTask(RService r, IProgressMonitor monitor) throws CoreException;
+ protected abstract void runRTask(RService r, ProgressMonitor m) throws StatusException;
}
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java
index d791a98..753d169 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo1/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java
@@ -20,15 +20,14 @@
import javax.security.auth.login.LoginException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistryManager;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
+import org.eclipse.statet.jcommons.rmi.RMIRegistryManager;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.NullProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.internal.rj.example.rcpdemo.Activator;
import org.eclipse.statet.rj.RjException;
@@ -38,7 +37,7 @@
import org.eclipse.statet.rj.server.client.RClientGraphicFactory;
import org.eclipse.statet.rj.server.osgi.ERJContext;
import org.eclipse.statet.rj.servi.RServi;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
import org.eclipse.statet.rj.servi.node.RServiImpl;
import org.eclipse.statet.rj.servi.node.RServiNodeConfig;
import org.eclipse.statet.rj.servi.node.RServiNodeFactory;
@@ -92,7 +91,7 @@
return this.schedulingRule;
}
- public void setLocalInst(final String rHome) throws CoreException {
+ public void setLocalInst(final String rHome) throws StatusException {
final Config config= new Config();
config.mode= LOCAL_INST;
config.address= rHome;
@@ -105,7 +104,7 @@
startLocal(rConfig);
}
- public void setRSetup(final String setupId) throws CoreException {
+ public void setRSetup(final String setupId) throws StatusException {
final Config config= new Config();
config.mode= LOCAL_RSETUP;
config.address= setupId;
@@ -113,7 +112,8 @@
final RSetup setup= RSetupUtil.loadSetup(setupId, null);
if (setup == null) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "No R setup with specified id found."));
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "No R setup with specified id found." ));
}
final RServiNodeConfig rConfig= new RServiNodeConfig();
@@ -145,16 +145,16 @@
}
}
- private void startLocal(final RServiNodeConfig rConfig) throws CoreException {
+ private void startLocal(final RServiNodeConfig rConfig) throws StatusException {
startLocal(rConfig, new NullProgressMonitor()); // TODO real monitor, e.g. in a Job
}
private void startLocal(final RServiNodeConfig rConfig,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (rConfig == null) {
throw new NullPointerException("rConfig");
}
- if (monitor == null) {
+ if (m == null) {
throw new NullPointerException("monitor");
}
try {
@@ -167,7 +167,7 @@
System.setSecurityManager(new SecurityManager());
}
- final RMIRegistry registry= RMIRegistryManager.INSTANCE.getEmbeddedPrivateRegistry(monitor);
+ final RMIRegistry registry= RMIRegistryManager.INSTANCE.getEmbeddedPrivateRegistry(m);
final RServiNodeFactory nodeFactory= RServiImpl.createLocalNodeFactory(this.name, context);
nodeFactory.setRegistry(registry);
@@ -182,12 +182,13 @@
this.localR= newLocalR;
}
catch (final RjException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "Local R instance could not created.", e));
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "Local R instance could not created.", e ));
}
}
- public RServi getRServi(final String task) throws CoreException {
+ public RServi getRServi(final String task) throws StatusException {
final Config config= this.config;
final String key= this.name + "-" + task;
@@ -195,21 +196,26 @@
switch (config.mode) {
case LOCAL_INST:
case LOCAL_RSETUP:
- return RServiUtil.getRServi(this.localR, key);
+ return RServiUtils.getRServi(this.localR, key);
case POOL:
- return RServiUtil.getRServi(config.address, key);
+ return RServiUtils.getRServi(config.address, key);
+ default:
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "R is not configured, please check the configuration." ));
}
}
- catch (final CoreException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "R not available, please check the configuration.", e));
+ catch (final StatusException e) {
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "R not available, please check the configuration.", e ));
}
catch (final LoginException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "R not available, please check the configuration.", e));
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "R not available, please check the configuration.", e ));
}
catch (final NoSuchElementException e) {
- throw new CoreException(new Status(IStatus.INFO, Activator.BUNDLE_ID, "R currently not available, please try again later.", e));
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "R currently not available, please try again later.", e ));
}
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "R is not configured, please check the configuration."));
}
}
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo2/META-INF/MANIFEST.MF b/examples/org.eclipse.statet.rj.example.rcpdemo2/META-INF/MANIFEST.MF
index 5edf821..cc1231f 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo2/META-INF/MANIFEST.MF
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo2/META-INF/MANIFEST.MF
@@ -9,7 +9,6 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.statet.ecommons.runtime.core;bundle-version="4.0.0";visibility:=reexport,
org.eclipse.core.runtime,
- org.eclipse.statet.ecommons.rmi.core;bundle-version="4.0.0",
org.eclipse.statet.rj.data;bundle-version="4.0.0",
org.eclipse.statet.rj.server;bundle-version="4.0.0",
org.eclipse.statet.rj.client;bundle-version="4.0.0",
@@ -17,4 +16,7 @@
org.eclipse.ui,
org.eclipse.statet.rj.eclient.core;bundle-version="4.0.0",
org.eclipse.statet.rj.eclient.graphics;bundle-version="4.0.0"
-Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0"
+Import-Package: org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.rmi;version="4.0.0",
+ org.eclipse.statet.jcommons.status;version="4.0.0",
+ org.eclipse.statet.jcommons.ts.core;version="4.0.0"
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java
index 3fd574c..bb0a99e 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/GraphDemoView.java
@@ -17,8 +17,6 @@
import static org.eclipse.statet.rj.eclient.graphics.RGraphicCompositeActionSet.CONTEXT_MENU_GROUP_ID;
import static org.eclipse.statet.rj.eclient.graphics.RGraphicCompositeActionSet.SIZE_MENU_GROUP_ID;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.swt.SWT;
@@ -36,16 +34,18 @@
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.services.IServiceLocator;
-import org.eclipse.statet.ecommons.ts.core.ToolRunnable;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.ToolRunnable;
import org.eclipse.statet.internal.rj.example.rcpdemo.Activator;
-import org.eclipse.statet.rj.eclient.core.AbstractRToolRunnable;
-import org.eclipse.statet.rj.eclient.core.RToolService;
import org.eclipse.statet.rj.eclient.graphics.ERGraphic;
import org.eclipse.statet.rj.eclient.graphics.RGraphicComposite;
import org.eclipse.statet.rj.eclient.graphics.RGraphicCompositeActionSet;
import org.eclipse.statet.rj.graphic.core.RGraphic;
import org.eclipse.statet.rj.services.RGraphicCreator;
+import org.eclipse.statet.rj.ts.core.AbstractRToolRunnable;
+import org.eclipse.statet.rj.ts.core.RToolService;
/**
@@ -156,15 +156,14 @@
final String command= this.commandControl.getText();
final ToolRunnable job= new AbstractRToolRunnable("r/demo/graphic", "Graphic Demo") {
@Override
- protected void run(final RToolService r,
- final IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Creating graphic in R...", 100);
+ protected void run(final RToolService r, final ProgressMonitor m) throws StatusException {
+ m.beginTask("Creating graphic in R...", 100);
final RGraphicCreator rGraphicCreator= r.createRGraphicCreator(0);
rGraphicCreator.setSize(size.x, size.y);
- final RGraphic plot= rGraphicCreator.create(command, monitor);
+ final RGraphic plot= rGraphicCreator.create(command, m);
- monitor.worked(90);
+ m.addWorked(90);
if (plot instanceof ERGraphic) {
final ERGraphic erPlot= (ERGraphic) plot;
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java
index dab2c69..d828726 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/internal/rj/example/rcpdemo/views/RServiConfigView.java
@@ -14,7 +14,6 @@
package org.eclipse.statet.internal.rj.example.rcpdemo.views;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
@@ -30,6 +29,8 @@
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.statet.jcommons.status.StatusException;
+
import org.eclipse.statet.internal.rj.example.rcpdemo.Activator;
import org.eclipse.statet.rj.example.rcpdemo.RServiManager;
@@ -143,7 +144,7 @@
return;
}
}
- catch (final CoreException e) {
+ catch (final StatusException e) {
StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID,
"Could not apply RServi configuration.", e),
StatusManager.SHOW | StatusManager.LOG);
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java
index 52ea4d8..91abd30 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiManager.java
@@ -21,19 +21,22 @@
import javax.security.auth.login.LoginException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
import org.eclipse.ui.statushandlers.StatusManager;
import org.eclipse.statet.jcommons.lang.Disposable;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
+import org.eclipse.statet.jcommons.rmi.RMIRegistryManager;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.InfoStatus;
+import org.eclipse.statet.jcommons.status.NullProgressMonitor;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.ts.core.Tool;
+import org.eclipse.statet.jcommons.ts.core.ToolRunnable;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistryManager;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.ts.core.ToolRunnable;
+import org.eclipse.statet.ecommons.runtime.core.util.StatusUtils;
import org.eclipse.statet.internal.rj.example.rcpdemo.Activator;
import org.eclipse.statet.rj.RjException;
@@ -44,7 +47,7 @@
import org.eclipse.statet.rj.server.client.RClientGraphicFactory;
import org.eclipse.statet.rj.server.osgi.ERJContext;
import org.eclipse.statet.rj.servi.RServi;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
import org.eclipse.statet.rj.servi.node.RServiImpl;
import org.eclipse.statet.rj.servi.node.RServiNodeConfig;
import org.eclipse.statet.rj.servi.node.RServiNodeFactory;
@@ -85,7 +88,7 @@
}
- public void setLocalInst(final String rHome) throws CoreException {
+ public void setLocalInst(final String rHome) throws StatusException {
closeRServiSession();
final Config config= new Config();
@@ -100,7 +103,7 @@
startLocal(rConfig);
}
- public void setRSetup(final String setupId) throws CoreException {
+ public void setRSetup(final String setupId) throws StatusException {
closeRServiSession();
final Config config= new Config();
@@ -110,7 +113,8 @@
final RSetup setup= RSetupUtil.loadSetup(setupId, null);
if (setup == null) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "No R setup with specified id found."));
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "No R setup with specified id found." ));
}
final RServiNodeConfig rConfig= new RServiNodeConfig();
@@ -144,16 +148,16 @@
}
}
- private void startLocal(final RServiNodeConfig rConfig) throws CoreException {
+ private void startLocal(final RServiNodeConfig rConfig) throws StatusException {
startLocal(rConfig, new NullProgressMonitor()); // TODO real monitor, e.g. in a Job
}
private void startLocal(final RServiNodeConfig rConfig,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (rConfig == null) {
throw new NullPointerException("rConfig");
}
- if (monitor == null) {
+ if (m == null) {
throw new NullPointerException("monitor");
}
try {
@@ -166,7 +170,7 @@
System.setSecurityManager(new SecurityManager());
}
- final RMIRegistry registry= RMIRegistryManager.INSTANCE.getEmbeddedPrivateRegistry(monitor);
+ final RMIRegistry registry= RMIRegistryManager.INSTANCE.getEmbeddedPrivateRegistry(m);
final RServiNodeFactory nodeFactory= RServiImpl.createLocalNodeFactory(this.name, context);
nodeFactory.setRegistry(registry);
@@ -181,12 +185,13 @@
this.localR= newLocalR;
}
catch (final RjException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "Local R instance could not created.", e));
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "Local R instance could not created.", e ));
}
}
- public synchronized Tool getRServiSession() throws CoreException {
+ public synchronized Tool getRServiSession() throws StatusException {
if (this.currentSession == null) {
final RServi servi= getRServi("session");
this.currentSession= new RServiSession(servi) {
@@ -212,18 +217,17 @@
}
- public void schedule(final ToolRunnable runnable) throws CoreException {
+ public void schedule(final ToolRunnable runnable) throws StatusException {
final Tool session= getRServiSession();
- final IStatus status;
+ final Status status;
if (session != null) {
status= session.getQueue().add(runnable);
}
else {
- status= new Status(IStatus.ERROR, Activator.BUNDLE_ID,
- "R engine not available.");
+ status= new ErrorStatus(Activator.BUNDLE_ID, "R engine not available.");
}
- if (!status.isOK()) {
- throw new CoreException(status);
+ if (status.getSeverity() != Status.OK) {
+ throw new StatusException(status);
}
}
@@ -231,9 +235,9 @@
try {
schedule(runnable);
}
- catch (final CoreException e) {
- final Status status= new Status(e.getStatus().getSeverity(), Activator.BUNDLE_ID,
- "Cannot schedule '" + runnable.getLabel() + "'", e);
+ catch (final StatusException e) {
+ final IStatus status= new org.eclipse.core.runtime.Status(e.getStatus().getSeverity(), Activator.BUNDLE_ID,
+ "Cannot schedule '" + runnable.getLabel() + "'", StatusUtils.convert(e) );
StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
}
}
@@ -250,7 +254,7 @@
}
}
- private RServi getRServi(final String task) throws CoreException {
+ private RServi getRServi(final String task) throws StatusException {
final Config config= this.config;
final String key= this.name + "-" + task;
@@ -258,21 +262,29 @@
switch (config.mode) {
case LOCAL_INST:
case LOCAL_RSETUP:
- return RServiUtil.getRServi(this.localR, key);
+ return RServiUtils.getRServi(this.localR, key);
case POOL:
- return RServiUtil.getRServi(config.address, key);
+ return RServiUtils.getRServi(config.address, key);
+ default:
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "R is not configured, please check the configuration." ));
}
}
- catch (final CoreException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "R not available, please check the configuration.", e));
+ catch (final StatusException e) {
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "R not available, please check the configuration.",
+ e ));
}
catch (final LoginException e) {
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "R not available, please check the configuration.", e));
+ throw new StatusException(new ErrorStatus(Activator.BUNDLE_ID,
+ "R not available, please check the configuration.",
+ e ));
}
catch (final NoSuchElementException e) {
- throw new CoreException(new Status(IStatus.INFO, Activator.BUNDLE_ID, "R currently not available, please try again later.", e));
+ throw new StatusException(new InfoStatus(Activator.BUNDLE_ID,
+ "R currently not available, please try again later.",
+ e ));
}
- throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "R is not configured, please check the configuration."));
}
}
diff --git a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiSession.java b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiSession.java
index d6cfeb6..336096a 100644
--- a/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiSession.java
+++ b/examples/org.eclipse.statet.rj.example.rcpdemo2/src/org/eclipse/statet/rj/example/rcpdemo/RServiSession.java
@@ -19,11 +19,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
@@ -32,51 +30,57 @@
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.lang.Nullable;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
+import org.eclipse.statet.jcommons.status.Statuses;
+import org.eclipse.statet.jcommons.ts.core.SystemRunnable;
+import org.eclipse.statet.jcommons.ts.core.Tool;
+import org.eclipse.statet.jcommons.ts.core.ToolQueue;
+import org.eclipse.statet.jcommons.ts.core.ToolRunnable;
+import org.eclipse.statet.jcommons.ts.core.ToolService;
-import org.eclipse.statet.ecommons.ts.core.SystemRunnable;
-import org.eclipse.statet.ecommons.ts.core.Tool;
-import org.eclipse.statet.ecommons.ts.core.ToolQueue;
-import org.eclipse.statet.ecommons.ts.core.ToolRunnable;
-import org.eclipse.statet.ecommons.ts.core.ToolService;
+import org.eclipse.statet.ecommons.runtime.core.util.StatusUtils;
import org.eclipse.statet.internal.rj.example.rcpdemo.Activator;
import org.eclipse.statet.internal.rj.servi.RServiImpl;
import org.eclipse.statet.rj.data.RObject;
import org.eclipse.statet.rj.data.RReference;
-import org.eclipse.statet.rj.eclient.core.RToolService;
import org.eclipse.statet.rj.servi.RServi;
import org.eclipse.statet.rj.services.FQRObject;
import org.eclipse.statet.rj.services.FunctionCall;
import org.eclipse.statet.rj.services.RGraphicCreator;
import org.eclipse.statet.rj.services.RPlatform;
-import org.eclipse.statet.rj.services.RService;
+import org.eclipse.statet.rj.ts.core.RTool;
+import org.eclipse.statet.rj.ts.core.RToolService;
/**
- * Implementations of ECommons Tool Service and Scheduling interfaces (org.eclipse.statet.ecommons.ts.core) for
+ * Implementations of ECommons Tool Service and Scheduling interfaces (org.eclipse.statet.jcommons.ts.core) for
* RServi using Eclipse jobs.
*/
@NonNullByDefault
-public class RServiSession extends PlatformObject implements Tool {
+public class RServiSession extends PlatformObject implements RTool {
private class Queue implements ToolQueue {
@Override
- public IStatus add(final ToolRunnable runnable) {
+ public Status add(final ToolRunnable runnable) {
synchronized (RServiSession.this.jobs) {
if (isTerminated()) {
- return new Status(IStatus.ERROR, Activator.BUNDLE_ID,
+ return new ErrorStatus(Activator.BUNDLE_ID,
"The R session is terminated.");
}
if (!runnable.changed(ToolRunnable.ADDING_TO, RServiSession.this)) {
- return Status.CANCEL_STATUS;
+ return Statuses.CANCEL_STATUS;
}
final RunnableJob job= new RunnableJob(runnable);
RServiSession.this.jobs.add(job);
job.addJobChangeListener(RServiSession.this.jobListener);
job.schedule();
- return Status.OK_STATUS;
+ return Statuses.OK_STATUS;
}
}
@@ -107,7 +111,7 @@
}
@Override
- public IStatus addHot(final ToolRunnable runnable) {
+ public Status addHot(final ToolRunnable runnable) {
return add(runnable);
}
@@ -118,10 +122,10 @@
}
- private class RServiService implements RToolService, RService, ToolService {
+ private class RServiService implements RToolService {
@Override
- public Tool getTool() {
+ public RTool getTool() {
return RServiSession.this;
}
@@ -132,87 +136,88 @@
@Override
public void evalVoid(final String expression,
- final IProgressMonitor monitor) throws CoreException {
- RServiSession.this.servi.evalVoid(expression, monitor);
+ final ProgressMonitor m) throws StatusException {
+ RServiSession.this.servi.evalVoid(expression, m);
}
@Override
public void evalVoid(final String expression, final @Nullable RObject envir,
- final IProgressMonitor monitor) throws CoreException {
- RServiSession.this.servi.evalVoid(expression, envir, monitor);
+ final ProgressMonitor m) throws StatusException {
+ RServiSession.this.servi.evalVoid(expression, envir, m);
}
@Override
public RObject evalData(final String expression,
- final IProgressMonitor monitor) throws CoreException {
- return RServiSession.this.servi.evalData(expression, monitor);
+ final ProgressMonitor m) throws StatusException {
+ return RServiSession.this.servi.evalData(expression, m);
}
@Override
public RObject evalData(final String expression,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
- return RServiSession.this.servi.evalData(expression, factoryId, options, depth, monitor);
+ final ProgressMonitor m) throws StatusException {
+ return RServiSession.this.servi.evalData(expression, factoryId, options, depth, m);
}
@Override
public RObject evalData(final String expression, final @Nullable RObject envir,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
- return RServiSession.this.servi.evalData(expression, envir, factoryId, options, depth, monitor);
+ final ProgressMonitor m) throws StatusException {
+ return RServiSession.this.servi.evalData(expression, envir, factoryId, options, depth, m);
}
@Override
public RObject evalData(final RReference reference,
- final IProgressMonitor monitor) throws CoreException {
- return RServiSession.this.servi.evalData(reference, monitor);
+ final ProgressMonitor m) throws StatusException {
+ return RServiSession.this.servi.evalData(reference, m);
}
@Override
public RObject evalData(final RReference reference,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
- return RServiSession.this.servi.evalData(reference, factoryId, options, depth, monitor);
+ final ProgressMonitor m) throws StatusException {
+ return RServiSession.this.servi.evalData(reference, factoryId, options, depth, m);
}
@Override
- public @Nullable FQRObject findData(final String symbol, final @Nullable RObject env, final boolean inherits,
+ public @Nullable FQRObject<RTool> findData(final String symbol, final @Nullable RObject env, final boolean inherits,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
- return RServiSession.this.servi.findData(symbol, env, inherits, factoryId, options, depth, monitor);
+ final ProgressMonitor m) throws StatusException {
+ return (FQRObject<RTool>) RServiSession.this.servi.findData(symbol, env, inherits,
+ factoryId, options, depth, m );
}
@Override
public void assignData(final String expression, final RObject data,
- final IProgressMonitor monitor) throws CoreException {
- RServiSession.this.servi.assignData(expression, data, monitor);
+ final ProgressMonitor m) throws StatusException {
+ RServiSession.this.servi.assignData(expression, data, m);
}
@Override
public void uploadFile(final InputStream in, final long length, final String fileName,
- final int options, final IProgressMonitor monitor) throws CoreException {
- RServiSession.this.servi.uploadFile(in, length, fileName, options, monitor);
+ final int options, final ProgressMonitor m) throws StatusException {
+ RServiSession.this.servi.uploadFile(in, length, fileName, options, m);
}
@Override
public void downloadFile(final OutputStream out, final String fileName, final int options,
- final IProgressMonitor monitor) throws CoreException {
- RServiSession.this.servi.downloadFile(fileName, options, monitor);
+ final ProgressMonitor m) throws StatusException {
+ RServiSession.this.servi.downloadFile(fileName, options, m);
}
@Override
public byte[] downloadFile(final String fileName, final int options,
- final IProgressMonitor monitor) throws CoreException {
- return RServiSession.this.servi.downloadFile(fileName, options, monitor);
+ final ProgressMonitor m) throws StatusException {
+ return RServiSession.this.servi.downloadFile(fileName, options, m);
}
@Override
- public FunctionCall createFunctionCall(final String name) throws CoreException {
+ public FunctionCall createFunctionCall(final String name) throws StatusException {
return RServiSession.this.servi.createFunctionCall(name);
}
@Override
- public RGraphicCreator createRGraphicCreator(final int options) throws CoreException {
+ public RGraphicCreator createRGraphicCreator(final int options) throws StatusException {
return RServiSession.this.servi.createRGraphicCreator(options);
}
@@ -245,17 +250,18 @@
@Override
protected IStatus run(final IProgressMonitor monitor) {
+ final ProgressMonitor m= StatusUtils.convert(monitor, 1);
try {
- this.runnable.run(RServiSession.this.service, monitor);
+ this.runnable.run(RServiSession.this.service, m);
this.runnable.changed(ToolRunnable.FINISHING_OK, RServiSession.this);
- return Status.OK_STATUS;
+ return org.eclipse.core.runtime.Status.OK_STATUS;
}
- catch (final CoreException e) {
+ catch (final StatusException e) {
if (e.getStatus() != null && e.getStatus().getSeverity() == IStatus.CANCEL) {
this.runnable.changed(ToolRunnable.FINISHING_CANCEL, RServiSession.this);
- return e.getStatus();
+ return StatusUtils.convert(e.getStatus());
}
- final Status status= new Status(IStatus.ERROR, Activator.BUNDLE_ID,
+ final IStatus status= new org.eclipse.core.runtime.Status(IStatus.ERROR, Activator.BUNDLE_ID,
"An error occurred when running " + getName() + ".", e);
StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
this.runnable.changed(ToolRunnable.FINISHING_ERROR, RServiSession.this);
@@ -277,7 +283,7 @@
@Override
public void done(final IJobChangeEvent event) {
- if (event.getResult() == Status.CANCEL_STATUS) {
+ if (event.getResult().getSeverity() == IStatus.CANCEL) {
synchronized (RServiSession.this.jobs) {
if (RServiSession.this.jobs.remove(event.getJob())) {
((RunnableJob) event.getJob()).runnable.changed(ToolRunnable.BEING_ABANDONED, RServiSession.this);
@@ -342,8 +348,8 @@
}
@Override
- public boolean isProvidingFeatureSet(final String featureSetId) {
- return "org.eclipse.statet.rj.services.RService".equals(featureSetId); //$NON-NLS-1$
+ public boolean isProvidingFeatureSet(final String featureId) {
+ return R_SERVICE_FEATURE_ID.equals(featureId);
}
@Override
@@ -358,7 +364,7 @@
private void doStart() {
if (this.servi != null) {
- ((RServiImpl) this.servi).setRHandle(this);
+ ((RServiImpl<RTool>) this.servi).setRHandle(this);
this.state= 1;
}
else {
@@ -371,7 +377,7 @@
try {
this.servi.close();
}
- catch (final CoreException e) {
+ catch (final StatusException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -422,7 +428,7 @@
}
@Override
public void run(final ToolService service,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
doTerminate();
}
});
diff --git a/servi/org.eclipse.statet.rj.servi.webapp/.classpath b/servi/org.eclipse.statet.rj.servi.webapp/.classpath
index 4aacce5..7981dd0 100644
--- a/servi/org.eclipse.statet.rj.servi.webapp/.classpath
+++ b/servi/org.eclipse.statet.rj.servi.webapp/.classpath
@@ -25,6 +25,5 @@
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.equinox.common"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/servi/org.eclipse.statet.rj.servi.webapp/.settings/org.eclipse.wst.common.component b/servi/org.eclipse.statet.rj.servi.webapp/.settings/org.eclipse.wst.common.component
index ea03122..f86825d 100644
--- a/servi/org.eclipse.statet.rj.servi.webapp/.settings/org.eclipse.wst.common.component
+++ b/servi/org.eclipse.statet.rj.servi.webapp/.settings/org.eclipse.wst.common.component
@@ -2,10 +2,7 @@
<wb-module deploy-name="org.eclipse.statet.rj.servi.webapp">
<wb-resource deploy-path="/" source-path="/web"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
- <dependent-module archiveName="org.eclipse.statet.ecommons.runtime.core.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/org.eclipse.statet.ecommons.runtime.core/org.eclipse.statet.ecommons.runtime.core">
- <dependency-type>uses</dependency-type>
- </dependent-module>
- <dependent-module archiveName="org.eclipse.statet.ecommons.rmi.core.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/org.eclipse.statet.ecommons.rmi.core/org.eclipse.statet.ecommons.rmi.core">
+ <dependent-module archiveName="org.eclipse.statet.jcommons.util.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/org.eclipse.statet.jcommons.util/org.eclipse.statet.jcommons.util">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="org.eclipse.statet.rj.servi.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/org.eclipse.statet.rj.servi/org.eclipse.statet.rj.servi">
@@ -23,9 +20,6 @@
<dependent-module archiveName="org.eclipse.statet.rj.server.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/org.eclipse.statet.rj.server/org.eclipse.statet.rj.server">
<dependency-type>uses</dependency-type>
</dependent-module>
- <dependent-module archiveName="org.eclipse.statet.jcommons.util.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/org.eclipse.statet.jcommons.util/org.eclipse.statet.jcommons.util">
- <dependency-type>uses</dependency-type>
- </dependent-module>
<property name="java-output-path"/>
<property name="context-root" value="rservi"/>
</wb-module>
diff --git a/servi/org.eclipse.statet.rj.servi.webapp/pom.xml b/servi/org.eclipse.statet.rj.servi.webapp/pom.xml
index 4f377e4..1d495ec 100644
--- a/servi/org.eclipse.statet.rj.servi.webapp/pom.xml
+++ b/servi/org.eclipse.statet.rj.servi.webapp/pom.xml
@@ -17,6 +17,12 @@
<packaging>war</packaging>
<dependencies>
+ <!-- Commons -->
+ <dependency>
+ <groupId>org.eclipse.statet.commons</groupId>
+ <artifactId>org.eclipse.statet.jcommons.util</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </dependency>
<!-- RJ Servi -->
<dependency>
<groupId>org.eclipse.statet.rj</groupId>
diff --git a/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/EAppEnvDummy.java b/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/EAppEnvDummy.java
index a576d71..2b87578 100644
--- a/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/EAppEnvDummy.java
+++ b/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/EAppEnvDummy.java
@@ -23,14 +23,13 @@
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
-import org.eclipse.core.runtime.IStatus;
-
import org.eclipse.statet.jcommons.lang.Disposable;
-
-import org.eclipse.statet.ecommons.runtime.core.ECommonsRuntime;
+import org.eclipse.statet.jcommons.runtime.AppEnvironment;
+import org.eclipse.statet.jcommons.runtime.CommonsRuntime;
+import org.eclipse.statet.jcommons.status.Status;
-public class EAppEnvDummy implements ServletContextListener, ECommonsRuntime.AppEnvironment {
+public class EAppEnvDummy implements ServletContextListener, AppEnvironment {
private final CopyOnWriteArraySet<Disposable> stopListeners= new CopyOnWriteArraySet<>();
@@ -47,7 +46,7 @@
@Override
public void contextInitialized(final ServletContextEvent sce) {
this.context= sce.getServletContext();
- ECommons.init("org.eclipse.statet.rj.services.eruntime", this);
+ CommonsRuntime.init(this);
this.logger= Logger.getLogger("org.eclipse.statet.rj.servi.pool");
}
@@ -65,56 +64,24 @@
}
}
+
@Override
- public void addStoppingListener(final Disposable listener) {
- this.stopListeners.add(listener);
+ public String getBundleId() {
+ return "org.eclipse.statet.rj.services.eruntime";
}
- @Override
- public void removeStoppingListener(final Disposable listener) {
- this.stopListeners.remove(listener);
- }
-
-// public void log(final IStatus status) {
-// final StringBuilder sb= new StringBuilder();
-// switch (status.getSeverity()) {
-// case IStatus.OK:
-// sb.append("[OK] ");
-// break;
-// case IStatus.ERROR:
-// sb.append("[ERROR] ");
-// break;
-// case IStatus.WARNING:
-// sb.append("[WARNING] ");
-// break;
-// case IStatus.INFO:
-// sb.append("[INFO] ");
-// break;
-// case IStatus.CANCEL:
-// sb.append("[CANCEL] ");
-// break;
-// default:
-// sb.append("[severity=");
-// sb.append(status.getSeverity());
-// sb.append(']');
-// break;
-// }
-// sb.append(status.getMessage());
-//
-// this.context.log(sb.toString(), status.getException());
-// }
@Override
- public void log(final IStatus status) {
+ public void log(final Status status) {
final Level level;
switch (status.getSeverity()) {
- case IStatus.INFO:
+ case Status.INFO:
level= Level.INFO;
break;
- case IStatus.WARNING:
+ case Status.WARNING:
level= Level.WARNING;
break;
- case IStatus.ERROR:
+ case Status.ERROR:
level= Level.SEVERE;
break;
default:
@@ -141,4 +108,16 @@
this.logger.log(record);
}
+
+ @Override
+ public void addStoppingListener(final Disposable listener) {
+ this.stopListeners.add(listener);
+ }
+
+ @Override
+ public void removeStoppingListener(final Disposable listener) {
+ this.stopListeners.remove(listener);
+ }
+
+
}
diff --git a/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/PoolItemBean.java b/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/PoolItemBean.java
index 2a9ad02..0b9eccb 100644
--- a/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/PoolItemBean.java
+++ b/servi/org.eclipse.statet.rj.servi.webapp/src/org/eclipse/statet/rj/servi/webapp/PoolItemBean.java
@@ -14,7 +14,7 @@
package org.eclipse.statet.rj.servi.webapp;
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.servi.pool.PoolConfig;
diff --git a/servi/org.eclipse.statet.rj.servi/META-INF/MANIFEST.MF b/servi/org.eclipse.statet.rj.servi/META-INF/MANIFEST.MF
index b8fd772..ee31d02 100644
--- a/servi/org.eclipse.statet.rj.servi/META-INF/MANIFEST.MF
+++ b/servi/org.eclipse.statet.rj.servi/META-INF/MANIFEST.MF
@@ -9,13 +9,14 @@
Require-Bundle: org.eclipse.statet.rj.data;bundle-version="[4.0.0,4.1.0)",
org.eclipse.statet.rj.server;bundle-version="[4.0.0,4.1.0)",
org.eclipse.statet.rj.services.core;bundle-version="[4.0.0,4.1.0)";visibility:=reexport,
- org.eclipse.statet.rj.client;bundle-version="[4.0.0,4.1.0)",
- org.eclipse.statet.ecommons.runtime.core;bundle-version="4.0.0",
- org.eclipse.statet.ecommons.rmi.core;bundle-version="4.0.0"
+ org.eclipse.statet.rj.client;bundle-version="[4.0.0,4.1.0)"
Import-Package: org.apache.commons.pool2;version="[2.4.0,3.0.0)";resolution:=optional,
org.apache.commons.pool2.impl;version="[2.4.0,3.0.0)";resolution:=optional,
org.eclipse.statet.jcommons.collections;version="4.0.0",
- org.eclipse.statet.jcommons.lang;version="4.0.0"
+ org.eclipse.statet.jcommons.lang;version="4.0.0",
+ org.eclipse.statet.jcommons.rmi;version="4.0.0",
+ org.eclipse.statet.jcommons.runtime;version="4.0.0",
+ org.eclipse.statet.jcommons.status;version="4.0.0"
Export-Package: org.eclipse.statet.internal.rj.servi;x-friends:="org.eclipse.statet.rj.tests",
org.eclipse.statet.rj.servi;version="4.0.0",
org.eclipse.statet.rj.servi.node,
diff --git a/servi/org.eclipse.statet.rj.servi/plugin.xml b/servi/org.eclipse.statet.rj.servi/plugin.xml
index c500320..cc76509 100644
--- a/servi/org.eclipse.statet.rj.servi/plugin.xml
+++ b/servi/org.eclipse.statet.rj.servi/plugin.xml
@@ -19,7 +19,7 @@
<plugin>
<extension
- point="org.eclipse.statet.ecommons.rmi.ERegistry">
+ point="org.eclipse.statet.jcommons.rmi.ERegistry">
<codebaseEntry
pluginId="org.eclipse.statet.rj.server"/>
</extension>
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/FQRObjectImpl.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/FQRObjectImpl.java
deleted file mode 100644
index b5f6b5b..0000000
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/FQRObjectImpl.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*=============================================================================#
- # Copyright (c) 2017, 2018 Stephan Wahlbrink and others.
- #
- # This program and the accompanying materials are made available under the
- # terms of the Eclipse Public License 2.0 which is available at
- # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
- # which is available at https://www.apache.org/licenses/LICENSE-2.0.
- #
- # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
- #
- # Contributors:
- # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
- #=============================================================================*/
-
-package org.eclipse.statet.internal.rj.servi;
-
-import org.eclipse.statet.jcommons.lang.NonNullByDefault;
-
-import org.eclipse.statet.rj.data.REnvironment;
-import org.eclipse.statet.rj.data.RLanguage;
-import org.eclipse.statet.rj.data.RObject;
-import org.eclipse.statet.rj.data.impl.RLanguageImpl;
-import org.eclipse.statet.rj.services.FQRObject;
-
-
-@NonNullByDefault
-public class FQRObjectImpl implements FQRObject {
-
-
- private final Object rHandle;
-
- private final REnvironment env;
-
- private final RObject name;
-
- private final RObject object;
-
-
- public FQRObjectImpl(final Object rHandle, final REnvironment env, final RObject name, final RObject object) {
- this.rHandle= rHandle;
- this.env= env;
- this.name= name;
- this.object= object;
- }
-
- public FQRObjectImpl(final Object rHandle, final REnvironment env, final String name, final RObject object) {
- this.rHandle= rHandle;
- this.env= env;
- this.name= new RLanguageImpl(RLanguage.NAME, name, null);
- this.object= object;
- }
-
-
- @Override
- public Object getRHandle() {
- return this.rHandle;
- }
-
- @Override
- public REnvironment getEnv() {
- return this.env;
- }
-
- @Override
- public RObject getName() {
- return this.name;
- }
-
- @Override
- public RObject getObject() {
- return this.object;
- }
-
-}
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeFactory.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeFactory.java
index 850e035..43c07d5 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeFactory.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeFactory.java
@@ -34,9 +34,8 @@
import org.eclipse.statet.jcommons.collections.CollectionUtils;
import org.eclipse.statet.jcommons.collections.ImCollections;
import org.eclipse.statet.jcommons.collections.ImList;
-
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.RjInvalidConfigurationException;
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeManager.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeManager.java
index 5772282..85b669d 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeManager.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/LocalNodeManager.java
@@ -17,18 +17,15 @@
import java.rmi.RemoteException;
import java.util.NoSuchElementException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.statet.jcommons.lang.Disposable;
-
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
-import org.eclipse.statet.ecommons.runtime.core.ECommonsRuntime;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
+import org.eclipse.statet.jcommons.runtime.CommonsRuntime;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.RjInitFailedException;
import org.eclipse.statet.rj.servi.RServi;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
import org.eclipse.statet.rj.servi.node.RServiNodeFactory;
import org.eclipse.statet.rj.servi.node.RServiNodeManager;
@@ -91,10 +88,10 @@
try {
this.factory.createNode(poolObj);
this.handler= poolObj;
- ECommonsRuntime.getEnv().addStoppingListener(this);
+ CommonsRuntime.getEnvironment().addStoppingListener(this);
}
catch (final Throwable e) {
- ECommonsRuntime.getEnv().log(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID,
+ CommonsRuntime.log(new ErrorStatus(RServiUtils.RJ_SERVI_ID,
Messages.StartNode_error_message, e ));
throw new RjInitFailedException(Messages.StartLocal_pub_error_message,
(e instanceof RjException) ? e : null);
@@ -106,7 +103,7 @@
if (this.handler == null) {
return;
}
- ECommonsRuntime.getEnv().removeStoppingListener(this);
+ CommonsRuntime.getEnvironment().removeStoppingListener(this);
if (this.inUse) {
returnRServi(this.accessId);
if (this.handler == null) {
@@ -129,7 +126,7 @@
this.handler.bindClient(name, "local");
}
catch (final Throwable e) {
- ECommonsRuntime.getEnv().log(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID,
+ CommonsRuntime.log(new ErrorStatus(RServiUtils.RJ_SERVI_ID,
Messages.BindClient_error_message, e ));
throw new RjException(Messages.GetRServi_pub_error_message);
}
@@ -150,7 +147,7 @@
this.handler.unbindClient();
}
catch (final Throwable e) {
- ECommonsRuntime.getEnv().log(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID,
+ CommonsRuntime.log(new ErrorStatus(RServiUtils.RJ_SERVI_ID,
Messages.UnbindClient_error_message, e ));
stop();
}
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/NodeHandler.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/NodeHandler.java
index beb36b5..70be071 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/NodeHandler.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/NodeHandler.java
@@ -17,7 +17,7 @@
import java.io.File;
import java.rmi.RemoteException;
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
import org.eclipse.statet.internal.rj.servi.server.RServiBackend;
import org.eclipse.statet.rj.RjException;
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/RServiImpl.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/RServiImpl.java
index fc6c41e..ce6f7b6 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/RServiImpl.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/RServiImpl.java
@@ -25,15 +25,14 @@
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
import org.eclipse.statet.jcommons.lang.Nullable;
-
-import org.eclipse.statet.ecommons.runtime.core.ECommonsRuntime;
+import org.eclipse.statet.jcommons.runtime.CommonsRuntime;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.InfoStatus;
+import org.eclipse.statet.jcommons.status.ProgressMonitor;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.internal.rj.servi.server.RServiBackend;
import org.eclipse.statet.rj.RjException;
@@ -50,7 +49,8 @@
import org.eclipse.statet.rj.server.client.RClientGraphicFactory;
import org.eclipse.statet.rj.server.client.RGraphicCreatorImpl;
import org.eclipse.statet.rj.servi.RServi;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
+import org.eclipse.statet.rj.services.BasicFQRObject;
import org.eclipse.statet.rj.services.FQRObject;
import org.eclipse.statet.rj.services.FunctionCall;
import org.eclipse.statet.rj.services.RGraphicCreator;
@@ -62,7 +62,7 @@
* Client side {@link RServi} handler
*/
@NonNullByDefault
-public class RServiImpl implements RServi, Externalizable {
+public class RServiImpl<THandle> implements RServi, Externalizable {
private class RServiComClient extends AbstractRJComClient {
@@ -85,7 +85,8 @@
}
@Override
- protected void handleServerStatus(final RjsStatus serverStatus, final IProgressMonitor monitor) throws CoreException {
+ protected void handleServerStatus(final RjsStatus serverStatus,
+ final ProgressMonitor m) throws StatusException {
switch (serverStatus.getCode()) {
case 0:
return;
@@ -94,28 +95,29 @@
case Server.S_STOPPED:
break;
case RjsStatus.ERROR:
- throw new CoreException(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID, "Server or IO error."));
+ throw new StatusException(new ErrorStatus(RServiUtils.RJ_SERVI_ID, "Server or IO error."));
default:
throw new IllegalStateException();
}
if (!isClosed()) {
setClosed(true);
- handleStatus(new Status(IStatus.INFO, RServiUtil.RJ_SERVI_ID, "RServi is disconnected."), monitor);
+ handleStatus(new InfoStatus(RServiUtils.RJ_SERVI_ID, "RServi is disconnected."),
+ m );
}
- throw new CoreException(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID, "RServi is closed."));
+ throw new StatusException(new ErrorStatus(RServiUtils.RJ_SERVI_ID, "RServi is closed."));
}
@Override
- protected void handleStatus(final Status status, final IProgressMonitor monitor) {
- if (!status.isOK()) {
+ protected void handleStatus(final Status status, final ProgressMonitor m) {
+ if (status.getSeverity() != Status.OK) {
log(status);
}
}
@Override
- protected void log(final IStatus status) {
- ECommonsRuntime.getEnv().log(status);
+ protected void log(final Status status) {
+ CommonsRuntime.log(status);
}
}
@@ -133,7 +135,7 @@
private final AbstractRJComClient rjs= new RServiComClient();
private int rjsId;
- private Object rHandle;
+ private THandle rHandle;
public RServiImpl(final long accessId, final PoolRef ref, final RServiBackend backend) {
@@ -163,16 +165,16 @@
}
- public void setRHandle(final Object rHandle) {
+ public void setRHandle(final THandle rHandle) {
this.rHandle= rHandle;
}
- public Object getRHandle() {
+ public THandle getRHandle() {
return this.rHandle;
}
- private void init() throws CoreException {
+ private void init() throws StatusException {
this.rjsId= RjsComConfig.registerClientComHandler(this.rjs);
final Map<String, Object> properties= new HashMap<>();
this.rjs.initClient(this.rHandle, this, properties, this.rjsId);
@@ -185,18 +187,19 @@
}
@Override
- public synchronized void close() throws CoreException {
+ public synchronized void close() throws StatusException {
if (this.rjs.isClosed()) {
- throw new CoreException(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID, 0,
- "RServi is already closed.", null));
+ throw new StatusException(new ErrorStatus(RServiUtils.RJ_SERVI_ID,
+ "RServi is already closed." ));
}
try {
this.rjs.setClosed(true);
this.poolRef.returnObject(this.accessId);
}
catch (final Exception e) {
- throw new CoreException(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID, 0,
- "An error occurred when closing RServi instance.", e));
+ throw new StatusException(new ErrorStatus(RServiUtils.RJ_SERVI_ID,
+ "An error occurred when closing RServi instance.",
+ e ));
}
finally {
this.poolRef= null;
@@ -214,125 +217,125 @@
@Override
public void evalVoid(final String expression,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- this.rjs.evalVoid(expression, null, monitor);
+ this.rjs.evalVoid(expression, null, m);
}
@Override
public void evalVoid(final String expression, final @Nullable RObject envir,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- this.rjs.evalVoid(expression, envir, monitor);
+ this.rjs.evalVoid(expression, envir, m);
}
@Override
public RObject evalData(final String expression,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- return this.rjs.evalData(expression, null, null, 0, RService.DEPTH_INFINITE, monitor);
+ return this.rjs.evalData(expression, null, null, 0, RService.DEPTH_INFINITE, m);
}
@Override
public RObject evalData(final String expression,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- return this.rjs.evalData(expression, null, factoryId, options, depth, monitor);
+ return this.rjs.evalData(expression, null, factoryId, options, depth, m);
}
@Override
public RObject evalData(final String expression, final @Nullable RObject envir,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- return this.rjs.evalData(expression, envir, factoryId, options, depth, monitor);
+ return this.rjs.evalData(expression, envir, factoryId, options, depth, m);
}
@Override
public RObject evalData(final RReference reference,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- return this.rjs.evalData(reference, null, 0, -1, monitor);
+ return this.rjs.evalData(reference, null, 0, -1, m);
}
@Override
public RObject evalData(final RReference reference,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- return this.rjs.evalData(reference, factoryId, options, depth, monitor);
+ return this.rjs.evalData(reference, factoryId, options, depth, m);
}
@Override
- public @Nullable FQRObject findData(final String symbol, final @Nullable RObject env, final boolean inherits,
+ public @Nullable FQRObject<THandle> findData(final String symbol, final @Nullable RObject env, final boolean inherits,
final @Nullable String factoryId, final int options, final int depth,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- final RObject[] data= this.rjs.findData(symbol, env, inherits, factoryId, options, depth, monitor);
+ final RObject[] data= this.rjs.findData(symbol, env, inherits, factoryId, options, depth, m);
if (data != null) {
- return new FQRObjectImpl(this.rHandle, (REnvironment) data[1], symbol, data[0]);
+ return new BasicFQRObject<>(this.rHandle, (REnvironment) data[1], symbol, data[0]);
}
return null;
}
@Override
public void assignData(final String expression, final RObject data,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- this.rjs.assignData(expression, data, null, monitor);
+ this.rjs.assignData(expression, data, null, m);
}
@Override
public void downloadFile(final OutputStream out, final String fileName,
final int options,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- this.rjs.downloadFile(out, fileName, options, monitor);
+ this.rjs.downloadFile(out, fileName, options, m);
}
@Override
public byte[] downloadFile(final String fileName,
final int options,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- return this.rjs.downloadFile(fileName, options, monitor);
+ return this.rjs.downloadFile(fileName, options, m);
}
@Override
public void uploadFile(final InputStream in, final long length, final String fileName,
final int options,
- final IProgressMonitor monitor) throws CoreException {
+ final ProgressMonitor m) throws StatusException {
if (this.rjsId == 0) {
init();
}
- this.rjs.uploadFile(in, length, fileName, options, monitor);
+ this.rjs.uploadFile(in, length, fileName, options, m);
}
@Override
- public FunctionCall createFunctionCall(final String name) throws CoreException {
+ public FunctionCall createFunctionCall(final String name) throws StatusException {
if (this.rjsId == 0) {
init();
}
@@ -340,7 +343,7 @@
}
@Override
- public RGraphicCreator createRGraphicCreator(final int options) throws CoreException {
+ public RGraphicCreator createRGraphicCreator(final int options) throws StatusException {
if (this.rjsId == 0) {
init();
}
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/Utils.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/Utils.java
index 4d8b4a0..94ca157 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/Utils.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/internal/rj/servi/Utils.java
@@ -18,13 +18,12 @@
import java.util.List;
import java.util.Properties;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.statet.jcommons.runtime.CommonsRuntime;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.InfoStatus;
+import org.eclipse.statet.jcommons.status.WarningStatus;
-import org.eclipse.statet.ecommons.runtime.core.ECommonsRuntime;
-import org.eclipse.statet.ecommons.runtime.core.ECommonsRuntime.AppEnvironment;
-
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
public class Utils {
@@ -36,7 +35,7 @@
public static void preLoad() {
// Load class for errors
- new Status(IStatus.INFO, RServiUtil.RJ_SERVI_ID, Messages.StartNode_error_message);
+ new InfoStatus(RServiUtils.RJ_SERVI_ID, Messages.StartNode_error_message);
}
/**
@@ -164,45 +163,27 @@
}
public static void logInfo(final String message) {
- final AppEnvironment env= ECommonsRuntime.getEnv();
- if (env != null) {
- env.log(new Status(IStatus.INFO, RServiUtil.RJ_SERVI_ID, message));
- }
+ CommonsRuntime.log(new InfoStatus(RServiUtils.RJ_SERVI_ID, message));
}
public static void logInfo(final String message, final Throwable e) {
- final AppEnvironment env= ECommonsRuntime.getEnv();
- if (env != null) {
- env.log(new Status(IStatus.INFO, RServiUtil.RJ_SERVI_ID, message, e));
- }
+ CommonsRuntime.log(new InfoStatus(RServiUtils.RJ_SERVI_ID, message, e));
}
public static void logWarning(final String message) {
- final AppEnvironment env= ECommonsRuntime.getEnv();
- if (env != null) {
- env.log(new Status(IStatus.WARNING, RServiUtil.RJ_SERVI_ID, message));
- }
+ CommonsRuntime.log(new WarningStatus(RServiUtils.RJ_SERVI_ID, message));
}
public static void logWarning(final String message, final Throwable e) {
- final AppEnvironment env= ECommonsRuntime.getEnv();
- if (env != null) {
- env.log(new Status(IStatus.WARNING, RServiUtil.RJ_SERVI_ID, message, e));
- }
+ CommonsRuntime.log(new WarningStatus(RServiUtils.RJ_SERVI_ID, message, e));
}
public static void logError(final String message) {
- final AppEnvironment env= ECommonsRuntime.getEnv();
- if (env != null) {
- env.log(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID, message));
- }
+ CommonsRuntime.log(new ErrorStatus(RServiUtils.RJ_SERVI_ID, message));
}
public static void logError(final String message, final Throwable e) {
- final AppEnvironment env= ECommonsRuntime.getEnv();
- if (env != null) {
- env.log(new Status(IStatus.ERROR, RServiUtil.RJ_SERVI_ID, message, e));
- }
+ CommonsRuntime.log(new ErrorStatus(RServiUtils.RJ_SERVI_ID, message, e));
}
public static String getProperty(final Properties properties, final String key, final String altKey) {
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServi.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServi.java
index b45d694..41a5883 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServi.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServi.java
@@ -14,9 +14,8 @@
package org.eclipse.statet.rj.servi;
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.services.RService;
@@ -30,7 +29,7 @@
* The RServi framework includes a server side RServi
* {@link org.eclipse.statet.rj.servi.node.RServiPool pool}
* which can be used to provide RServi instances. To get a RServi instance
- * from such a pool which made available via RMI {@link org.eclipse.statet.rj.servi.pool.RServiUtil RServiUtil}
+ * from such a pool which made available via RMI {@link org.eclipse.statet.rj.servi.pool.RServiUtils RServiUtils}
* provides helper methods to request a RServi instance.</p>
* <p>
* In many applications it is sufficient to use an RServi for a direct
@@ -78,9 +77,9 @@
* After calling the method the RServi instance is closed even if the method
* thrown an exception.</p>
*
- * @throws CoreException if the operation failed; the status
+ * @throws StatusException if the operation failed; the status
* of the exception contains detail about the cause
*/
- void close() throws CoreException;
+ void close() throws StatusException;
}
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServiUtil.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServiUtils.java
similarity index 73%
rename from servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServiUtil.java
rename to servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServiUtils.java
index d94182b..16b3f4f 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServiUtil.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/RServiUtils.java
@@ -25,11 +25,10 @@
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.security.auth.login.LoginException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
+import org.eclipse.statet.jcommons.lang.NonNullByDefault;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
+import org.eclipse.statet.jcommons.status.ErrorStatus;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.server.RjsComConfig;
@@ -42,7 +41,8 @@
* <p>
* It is not intend to instance the class.</p>
*/
-public class RServiUtil {
+@NonNullByDefault
+public class RServiUtils {
public static final String RJ_SERVI_ID= "org.eclipse.statet.rj.servi";
@@ -63,53 +63,61 @@
* @param address the RMI address of the pool
* @param name a name which can be used to identify the client
* @return a reference to the RServi instance
- * @throws CoreException if the operation was failed; the status
+ * @throws StatusException if the operation was failed; the status
* of the exception contains detail about the cause
* @throws NoSuchElementException if there is currently no free RServi
- * instance available. A later call with the same configuration
+ * instance available. A later call with the same configuration
* can be successfully.
* @throws LoginException if the RServi request requires authentication
*/
- public static RServi getRServi(final String address, final String name) throws CoreException, NoSuchElementException, LoginException {
+ public static RServi getRServi(final String address, final String name)
+ throws StatusException, NoSuchElementException, LoginException {
try {
RjsComConfig.setRMIClientSocketFactory(null);
RServiPool pool;
try {
final RMIAddress rmiAddress= new RMIAddress(address);
- final Registry registry= LocateRegistry.getRegistry(rmiAddress.getHost(), rmiAddress.getPortNum(),
+ final Registry registry= LocateRegistry.getRegistry(rmiAddress.getHost(), rmiAddress.getPort(),
(rmiAddress.isSSL()) ? new SslRMIClientSocketFactory() : null );
pool= (RServiPool) registry.lookup(rmiAddress.getName());
}
catch (final MalformedURLException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "Invalid address for the RServi pool.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "Invalid address for the RServi pool.",
+ e ));
}
catch (final UnknownHostException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "Invalid address for the RServi pool.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "Invalid address for the RServi pool.",
+ e ));
}
catch (final NotBoundException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "The address does not point to a valid RServi pool.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "The address does not point to a valid RServi pool.",
+ e ));
}
catch (final ClassCastException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "The address does not point to a valid/compatible RServi pool.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "The address does not point to a valid/compatible RServi pool.",
+ e ));
}
catch (final RemoteException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "Failed looking for RServi pool in the RMI registry.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "Failed looking for RServi pool in the RMI registry.",
+ e ));
}
try {
return pool.getRServi(name, null);
}
catch (final RjException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "Failed getting an RServi instance from the RServi pool.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "Failed getting an RServi instance from the RServi pool.",
+ e ));
}
catch (final RemoteException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "Failed looking for RServi pool in the RMI registry.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "Failed looking for RServi pool in the RMI registry.",
+ e ));
}
}
finally {
@@ -128,28 +136,30 @@
* @param manager manager for RServi node(s)
* @param name a name which can be used to identify the client
* @return a reference to the RServi instance
- * @throws CoreException if the operation was failed; the status
+ * @throws StatusException if the operation was failed; the status
* of the exception contains detail about the cause
* @throws NoSuchElementException if there is currently no free RServi
- * instance available. A later call with the same configuration
+ * instance available. A later call with the same configuration
* can be successfully.
*/
- public static RServi getRServi(final RServiNodeManager manager, final String name) throws CoreException, NoSuchElementException {
+ public static RServi getRServi(final RServiNodeManager manager, final String name)
+ throws StatusException, NoSuchElementException {
if (manager == null) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "RServi is not available.", null));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "RServi is not available." ));
}
try {
return manager.getRServi(name);
}
catch (final RjException e) {
- throw new CoreException(new Status(IStatus.ERROR, RJ_SERVI_ID, 0,
- "Failed getting an RServi instance.", e));
+ throw new StatusException(new ErrorStatus(RJ_SERVI_ID,
+ "Failed getting an RServi instance.",
+ e ));
}
}
- private RServiUtil() {
+ private RServiUtils() {
}
}
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiImpl.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiImpl.java
index 0c48a17..39c285e 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiImpl.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiImpl.java
@@ -17,12 +17,11 @@
import static org.eclipse.statet.rj.server.util.ServerUtils.JCOMMONS_UTIL_ID;
import static org.eclipse.statet.rj.server.util.ServerUtils.RJ_DATA_ID;
import static org.eclipse.statet.rj.server.util.ServerUtils.RJ_SERVER_ID;
-import static org.eclipse.statet.rj.servi.RServiUtil.RJ_SERVI_ID;
+import static org.eclipse.statet.rj.servi.RServiUtils.RJ_SERVI_ID;
import org.eclipse.statet.jcommons.collections.ImCollections;
import org.eclipse.statet.jcommons.collections.ImList;
-
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
import org.eclipse.statet.internal.rj.servi.LocalNodeFactory;
import org.eclipse.statet.internal.rj.servi.LocalNodeManager;
diff --git a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiNodeFactory.java b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiNodeFactory.java
index a83e404..f4e011a 100644
--- a/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiNodeFactory.java
+++ b/servi/org.eclipse.statet.rj.servi/src/org/eclipse/statet/rj/servi/node/RServiNodeFactory.java
@@ -14,7 +14,7 @@
package org.eclipse.statet.rj.servi.node;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
import org.eclipse.statet.rj.RjInvalidConfigurationException;
diff --git a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNode.java b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNode.java
index c60704a..925c261 100644
--- a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNode.java
+++ b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNode.java
@@ -21,7 +21,7 @@
import javax.management.ObjectName;
import javax.management.OperationsException;
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.servi.jmx.NodeMXBean;
diff --git a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNodeState.java b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNodeState.java
index de0ed3b..d49acf0 100644
--- a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNodeState.java
+++ b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/MXNodeState.java
@@ -16,7 +16,7 @@
import java.util.Date;
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
import org.eclipse.statet.rj.servi.jmx.NodeStateMX;
import org.eclipse.statet.rj.servi.pool.PoolNodeItem;
diff --git a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/PoolManager.java b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/PoolManager.java
index 7341af3..f234f84 100644
--- a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/PoolManager.java
+++ b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/internal/rj/servi/PoolManager.java
@@ -25,8 +25,7 @@
import javax.rmi.ssl.SslRMIServerSocketFactory;
import org.eclipse.statet.jcommons.collections.CopyOnWriteIdentityListSet;
-
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
import org.eclipse.statet.rj.RjException;
import org.eclipse.statet.rj.RjInitFailedException;
diff --git a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/JMPoolServer.java b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/JMPoolServer.java
index 38885a4..556d13b 100644
--- a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/JMPoolServer.java
+++ b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/JMPoolServer.java
@@ -29,14 +29,12 @@
import javax.management.OperationsException;
import javax.rmi.ssl.SslRMIClientSocketFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-
import org.eclipse.statet.jcommons.collections.ImCollections;
-
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistry;
-import org.eclipse.statet.ecommons.rmi.core.RMIRegistryManager;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIRegistry;
+import org.eclipse.statet.jcommons.rmi.RMIRegistryManager;
+import org.eclipse.statet.jcommons.status.NullProgressMonitor;
+import org.eclipse.statet.jcommons.status.StatusException;
import org.eclipse.statet.internal.rj.servi.MXNetConfig;
import org.eclipse.statet.internal.rj.servi.MXNodeConfig;
@@ -51,7 +49,7 @@
import org.eclipse.statet.rj.RjInvalidConfigurationException;
import org.eclipse.statet.rj.server.util.RJContext;
import org.eclipse.statet.rj.server.util.ServerUtils;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
import org.eclipse.statet.rj.servi.jmx.PoolServerMXBean;
import org.eclipse.statet.rj.servi.jmx.PoolStatusMX;
import org.eclipse.statet.rj.servi.node.RServiImpl;
@@ -245,7 +243,7 @@
final String property= System.getProperty("java.rmi.server.codebase");
if (property == null) {
final List<String> libs= this.context.searchRJLibs(
- ImCollections.newList(ServerUtils.RJ_SERVER_ID, RServiUtil.RJ_SERVI_ID) );
+ ImCollections.newList(ServerUtils.RJ_SERVER_ID, RServiUtils.RJ_SERVI_ID) );
System.setProperty("java.rmi.server.codebase", ServerUtils.concatCodebase(libs));
}
@@ -295,7 +293,7 @@
throw new RjInitFailedException("Initalization of RMI registry setup failed.");
}
}
- catch (final CoreException ee) {
+ catch (final StatusException ee) {
Utils.logError("Failed to start embedded RMI registry at port "+registryPort+".", ee);
}
}
diff --git a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/NetConfig.java b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/NetConfig.java
index bb32bec..891f19b 100644
--- a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/NetConfig.java
+++ b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/NetConfig.java
@@ -20,7 +20,7 @@
import java.util.Collection;
import java.util.Properties;
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
import org.eclipse.statet.internal.rj.servi.Utils;
import org.eclipse.statet.rj.servi.node.PropertiesBean;
@@ -224,7 +224,7 @@
catch (final UnknownHostException e) {}
catch (final ArrayIndexOutOfBoundsException e) { /* JVM bug */ }
if (inet == null) {
- inet= RMIAddress.LOOPBACK;
+ inet= InetAddress.getLoopbackAddress();
}
}
this.effectiveHostaddress= inet.getHostAddress();
diff --git a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/PoolNodeItem.java b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/PoolNodeItem.java
index abf6613..897d57e 100644
--- a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/PoolNodeItem.java
+++ b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/PoolNodeItem.java
@@ -14,7 +14,7 @@
package org.eclipse.statet.rj.servi.pool;
-import org.eclipse.statet.ecommons.rmi.core.RMIAddress;
+import org.eclipse.statet.jcommons.rmi.RMIAddress;
import org.eclipse.statet.internal.rj.servi.NodeHandler;
import org.eclipse.statet.rj.RjException;
diff --git a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/StandalonePoolServer.java b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/StandalonePoolServer.java
index ef63e12..b258225 100644
--- a/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/StandalonePoolServer.java
+++ b/servi/org.eclipse.statet.rj.servi/srcServiPool/org/eclipse/statet/rj/servi/pool/StandalonePoolServer.java
@@ -20,17 +20,17 @@
import javax.management.OperationsException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
import org.eclipse.statet.jcommons.lang.Disposable;
-
-import org.eclipse.statet.ecommons.runtime.core.ECommonsRuntime;
+import org.eclipse.statet.jcommons.lang.NonNull;
+import org.eclipse.statet.jcommons.runtime.AppEnvironment;
+import org.eclipse.statet.jcommons.runtime.CommonsRuntime;
+import org.eclipse.statet.jcommons.status.Status;
+import org.eclipse.statet.jcommons.status.WarningStatus;
import org.eclipse.statet.rj.RjInitFailedException;
import org.eclipse.statet.rj.RjInvalidConfigurationException;
import org.eclipse.statet.rj.server.util.RJContext;
-import org.eclipse.statet.rj.servi.RServiUtil;
+import org.eclipse.statet.rj.servi.RServiUtils;
import org.eclipse.statet.rj.servi.jmx.StandalonePoolServerMXBean;
@@ -57,7 +57,7 @@
public class StandalonePoolServer extends JMPoolServer implements StandalonePoolServerMXBean {
- private static class EAppEnv implements ECommonsRuntime.AppEnvironment {
+ private static class EAppEnv implements AppEnvironment {
private final CopyOnWriteArraySet<Disposable> stopListeners= new CopyOnWriteArraySet<>();
@@ -76,10 +76,17 @@
@Override
- public void log(final IStatus status) {
+ public @NonNull String getBundleId() {
+ return RServiUtils.RJ_SERVI_ID;
+ }
+
+
+ @Override
+ public void log(final Status status) {
System.out.println(status.toString());
}
+
@Override
public void addStoppingListener(final Disposable listener) {
this.stopListeners.add(listener);
@@ -141,8 +148,9 @@
server.start();
}
catch (final OperationsException e) {
- ECommonsRuntime.getEnv().log(new Status(IStatus.WARNING, RServiUtil.RJ_SERVI_ID,
- "The server is started, but the pool could not be started.", e));
+ CommonsRuntime.log(new WarningStatus(RServiUtils.RJ_SERVI_ID,
+ "The server is started, but the pool could not be started.",
+ e ));
}
}
@@ -152,7 +160,7 @@
throw new IllegalArgumentException("No pool id specified.");
}
- ECommonsRuntime.init(RServiUtil.RJ_SERVI_ID, new EAppEnv());
+ CommonsRuntime.init(new EAppEnv());
final RJContext context= new RJContext(System.getProperty("user.dir")) {
@Override