Example usage for java.rmi RemoteException RemoteException

List of usage examples for java.rmi RemoteException RemoteException

Introduction

In this page you can find the example usage for java.rmi RemoteException RemoteException.

Prototype

public RemoteException(String s) 

Source Link

Document

Constructs a RemoteException with the specified detail message.

Usage

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public RVector getArrayValue(final long rObjectId, final String slotsPath) throws RemoteException {
    final RVector[] result = new RVector[1];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                result[0] = ((RArray) DirectJNI.getInstance().getObjectFrom(rootvar + slotsPath, true))
                        .getValue();/* w ww .  j a va2s.c  o  m*/
                e.rniEval(e.rniParse("rm(" + rootvar + ")", 1), 0);
            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));
    return result[0];
}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public long setArrayValue(final long rObjectId, final String slotsPath, final RVector value)
        throws RemoteException {
    final long[] result = new long[1];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                String argvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                e.rniAssign(argvar,// w  w  w.j  a  va2s .  c  om
                        DirectJNI.getInstance()
                                .putObject(value instanceof ReferenceInterface
                                        ? (RList) ((ReferenceInterface) value).extractRObject()
                                        : value),
                        0);
                e.rniEval(e.rniParse("dim(" + argvar + ")<-" + "dim(" + rootvar + slotsPath + ")", 1), 0);
                e.rniEval(e.rniParse("dimnames(" + argvar + ")<-" + "dimnames(" + rootvar + slotsPath + ")", 1),
                        0);
                result[0] = e.rniEval(e.rniParse(argvar, 1), 0);
                e.rniEval(e.rniParse("rm(" + rootvar + "," + argvar + ")", 1), 0);
            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));

    return result[0];

}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public int[] getArrayDim(final long rObjectId, final String slotsPath) throws RemoteException {
    final int[][] result = new int[1][];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);

                result[0] = e.rniGetIntArray(e.rniEval(e.rniParse("dim(" + rootvar + slotsPath + ")", 1), 0));

                e.rniEval(e.rniParse("rm(" + rootvar + ")", 1), 0);
            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }/*from  ww w. j  a va  2  s  . c om*/
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));
    return result[0];
}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public long setArrayDim(final long rObjectId, final String slotsPath, final int[] dim) throws RemoteException {
    final long[] result = new long[1];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                String argvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);

                if (dim != null) {
                    e.rniAssign(argvar, e.rniPutIntArray(dim), 0);
                } else {
                    e.rniEval(e.rniParse(argvar + "<-NULL", 1), 0);
                }/*  w w  w.j a va 2  s .  c  o  m*/

                e.rniEval(e.rniParse("dim(" + rootvar + slotsPath + ")<-" + argvar, 1), 0);
                result[0] = e.rniEval(e.rniParse(rootvar, 1), 0);
                e.rniEval(e.rniParse("rm(" + rootvar + "," + argvar + ")", 1), 0);

            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));

    return result[0];
}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public RList getArrayDimnames(final long rObjectId, final String slotsPath) throws RemoteException {
    final RList[] result = new RList[1];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                result[0] = (RList) DirectJNI.getInstance()
                        .getObjectFrom("dimnames(" + rootvar + slotsPath + ")", true);
                e.rniEval(e.rniParse("rm(" + rootvar + ")", 1), 0);
            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }// w  ww  .j  ava2  s  . c  o  m
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));
    return result[0];

}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public long setArrayDimnames(final long rObjectId, final String slotsPath, final RList dimnames)
        throws RemoteException {
    final long[] result = new long[1];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                String argvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                if (dimnames != null) {
                    e.rniAssign(argvar, DirectJNI.getInstance().putObject(dimnames), 0);
                } else {
                    e.rniEval(e.rniParse(argvar + "<-NULL", 1), 0);
                }//from w  w  w.ja v  a2  s.co  m

                e.rniEval(e.rniParse("dimnames(" + rootvar + slotsPath + ")<-" + argvar, 1), 0);
                result[0] = e.rniEval(e.rniParse(rootvar, 1), 0);
                e.rniEval(e.rniParse("rm(" + rootvar + "," + argvar + ")", 1), 0);
            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));

    return result[0];

}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public String[] factorAsData(final long rObjectId, final String slotsPath) throws RemoteException {
    final String[][] result = new String[1][];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                result[0] = e.rniGetStringArray(
                        e.rniEval(e.rniParse("as.character(" + rootvar + slotsPath + ")", 1), 0));
                e.rniEval(e.rniParse("rm(" + rootvar + ")", 1), 0);

            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }/*from ww w.  j a  v a2s .  com*/
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));
    return result[0];
}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public int[] getFactorCode(final long rObjectId, final String slotsPath) throws RemoteException {
    final int[][] result = new int[1][];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                result[0] = e/*from w  w w.  j a  v a  2  s.  c  o m*/
                        .rniGetIntArray(e.rniEval(e.rniParse("as.integer(" + rootvar + slotsPath + ")", 1), 0));
                e.rniEval(e.rniParse("rm(" + rootvar + ")", 1), 0);

            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));
    return result[0];
}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public String[] getFactorLevels(final long rObjectId, final String slotsPath) throws RemoteException {
    final String[][] result = new String[1][];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                result[0] = e//from   w  w  w.  jav a 2s .  c o  m
                        .rniGetStringArray(e.rniEval(e.rniParse("levels(" + rootvar + slotsPath + ")", 1), 0));
                e.rniEval(e.rniParse("rm(" + rootvar + ")", 1), 0);

            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));
    return result[0];

}

From source file:org.kchine.r.server.impl.DefaultAssignInterfaceImpl.java

public long setFactorCode(final long rObjectId, final String slotsPath, final int[] code)
        throws RemoteException {
    final long[] result = new long[1];
    final Exception[] exceptionHolder = new Exception[1];
    DirectJNI.getInstance().runR(new org.kchine.r.server.ExecutionUnit() {
        public void run(Rengine e) {
            try {
                String rootvar = DirectJNI.getInstance().newTemporaryVariableName();
                String argvar = DirectJNI.getInstance().newTemporaryVariableName();
                e.rniAssign(rootvar, rObjectId, 0);
                e.rniAssign(argvar, DirectJNI.getInstance().putObject(new RFactor(null, code)), 0);
                e.rniEval(e.rniParse("levels(" + argvar + ")<-" + "levels(" + rootvar + slotsPath + ")", 1), 0);
                result[0] = e.rniEval(e.rniParse(argvar, 1), 0);
                e.rniEval(e.rniParse("rm(" + rootvar + "," + argvar + ")", 1), 0);
            } catch (Exception ex) {
                exceptionHolder[0] = ex;
            }/* w ww . j  a  v a 2  s.  com*/
        }
    });
    if (exceptionHolder[0] != null)
        throw new RemoteException(Utils.getStackTraceAsString(exceptionHolder[0]));

    return result[0];
}