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:com.symbian.driver.remoting.master.MasterRemoteImpl.java

/**
 * /*from ww w .j  av  a2  s.  c  o  m*/
 * @see com.symbian.driver.remoting.master.MasterRemote#submitJob(com.symbian.driver.remoting.client.TestJob)
 */
public int submitJob(TestJob aTestJob) throws RemoteException {
    // Assign a job id.
    jobCounter.increment();
    jobCounter.takeSnapshot(); // Need to take a snapshot at this point.
    int lTestJobId = jobCounter.get();
    aTestJob.setId(lTestJobId);

    // Add state of this job to the tracker.
    JobTracker.add(aTestJob.getId(), aTestJob.getState());

    // Create the folder for caching the files based on the testJobId.
    File lTargetFolder = new File(jobsFolder + File.separator + lTestJobId + File.separator + "Input");

    try {
        lTargetFolder.mkdirs();
    } catch (SecurityException lSE) {
        LOGGER.log(Level.SEVERE,
                "Master: Unable to create input folder " + lTargetFolder + " for job " + lTestJobId + ".", lSE);
        throw new RemoteException("Master having problems creating the job input folder.");
    }

    // Cache the test package and image into the appropriate location.
    aTestJob.setTargetFolder(lTargetFolder.getAbsolutePath());
    boolean ret = getRemoteFile(aTestJob);
    if (!ret) {
        throw new RemoteException("Master having problems caching the files sent with the job.");
    }

    // Create the folder for the results based on the testJobId.
    File lResultsFolder = new File(jobsFolder + File.separator + lTestJobId + File.separator + "Output");
    try {
        lResultsFolder.mkdirs();
    } catch (SecurityException lSE) {
        LOGGER.log(Level.SEVERE, "Master: Unable to create output folder for job " + lTestJobId + ".", lSE);
        throw new RemoteException("Master having problems creating the job results folder.");
    }

    // Set the results folder. Needed by testwrapper.
    aTestJob.setResultsFolder(lResultsFolder.getAbsolutePath());

    // Add job to the executor queue.
    executorQueue.queueJob(aTestJob);

    return lTestJobId; // if successfully submitted return job id else if
    // failed exception would have been thrown.
}

From source file:gridool.GridServer.java

@Override
public GridNode delegate(boolean onlySuperNode) throws RemoteException {
    final GridRouter router = kernel.getResourceRegistry().getRouter();
    final GridNode[] nodes = router.getAllNodes();
    if (nodes.length == 0) {
        if (LOG.isInfoEnabled()) {
            LOG.info("No node found on the grid");
        }//from w  w  w.j  a v a  2 s .  c  o  m
        return null;
    }

    final List<GridNode> nodeList;
    if (onlySuperNode) {
        final List<GridNode> superNodes = GridUtils.selectSuperNodes(nodes);
        if (superNodes.isEmpty()) {
            final String errmsg = "Super nodes do not exist in the Grid (total " + nodes.length + " nodes)";
            LOG.error(errmsg);
            throw new RemoteException(errmsg);
        } else {
            nodeList = superNodes;
        }
    } else {
        nodeList = Arrays.asList(nodes);
    }

    GridNodeSelector selector = GridNodeSelectorFactory.createSelector();
    GridConfiguration config = kernel.getConfiguration();
    GridNode node = selector.selectNode(nodeList, config);
    return node;
}

From source file:org.segator.plex.cloud.transcoding.scheduled.MachineImageBuilder.java

private void waitForActionComplete(Action actionTrigger)
        throws DigitalOceanException, RequestUnsuccessfulException, RemoteException, InterruptedException {
    boolean actionCompleted = false;
    while (!actionCompleted) {
        Thread.sleep(2000);/*w w  w  .ja v  a2 s.c  o  m*/
        Action action = applicationParameters.getDOClient().getActionInfo(actionTrigger.getId());
        if (action.getStatus() == ActionStatus.COMPLETED) {
            actionCompleted = true;
        } else if (action.getStatus() == ActionStatus.ERRORED) {
            throw new RemoteException("Error on do Action ID:" + action.getId());
        }
    }
}

From source file:com.octo.captcha.j2ee.rpc.ImageCaptchaWebServiceEndpoint.java

/**
 * @see com.octo.captcha.j2ee.ImageCaptchaService#generateCaptchaAndRenderChallengeAsJpeg(java.lang.String)
 *
 * @param theCaptchaID a unique ID for the requested captcha
 * @return an Jpeg image//w  w  w. j a va 2  s  . co m
 * @throws RemoteException with a generic message if the
 * an exception occured during method execution. An error log
 * is also provided for the service endpoint operator.
 */
public byte[] generateCaptchaAndRenderChallengeAsJpeg(String theCaptchaID) throws RemoteException {
    byte[] captchaJpeg = null;
    try {
        captchaJpeg = this.imageCaptchaService.generateCaptchaAndRenderChallengeAsJpeg(theCaptchaID);
    } catch (ImageCaptchaServiceException e) {
        // log a message to the service endpoint operator
        log.error(e.getMessage());
        // returns a generic exception to the end user
        throw new RemoteException("Service is temporarily unavailable." + " Please try again later.");
    } catch (IllegalArgumentException e) {
        // route the exception to the end user
        throw new RemoteException(e.getMessage());
    }

    return captchaJpeg;
}

From source file:edu.northwestern.bioinformatics.studycalendar.grid.PSCStudyService.java

private edu.northwestern.bioinformatics.studycalendar.grid.Study populateGridStudy(String studyXML)
        throws Exception {
    try {/*from  w w w .  j av  a2s.co  m*/
        InputStream config = Thread.currentThread().getContextClassLoader().getResourceAsStream(
                "edu/northwestern/bioinformatics/studycalendar/grid/client/client-config.wsdd");
        Reader reader = new StringBufferReader(new StringBuffer(studyXML));
        edu.northwestern.bioinformatics.studycalendar.grid.Study gridStudy = (edu.northwestern.bioinformatics.studycalendar.grid.Study) Utils
                .deserializeObject(reader, edu.northwestern.bioinformatics.studycalendar.grid.Study.class,
                        config);
        return gridStudy;

    } catch (Exception exception) {
        logger.error("errror while exporting study. genreated study xml:" + studyXML + " message:"
                + exception.getMessage());
        throw new RemoteException(exception.getMessage());
    }
}

From source file:com.vmware.vim25.ws.ApacheHttpClient.java

/**
 * Invoke a given method with supplied {@link com.vmware.vim25.ws.Argument} on the remote vi server.
 * Returns a {@link StringBuffer} This works the same as the above call except there is no
 * conversion done on the return data and instead you just get back the StringBuffer content.
 *
 * @param methodName Name of the method to execute
 * @param paras      Array of Arguments aka params for the method
 * @return StringBuffer with the//from  w  w w  .  j a va2s  .  c o  m
 *
 * @throws java.rmi.RemoteException
 */
@Override
public StringBuffer invokeAsString(String methodName, Argument[] paras) throws RemoteException {
    String soapMsg = XmlGen.toXML(methodName, paras, this.vimNameSpace);

    try {
        InputStream is = post(soapMsg);
        return readStream(is);
    } catch (Exception e) {
        throw new RemoteException("VI SDK invoke exception:" + e);
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.grid.PSCStudyServiceTest.java

private edu.northwestern.bioinformatics.studycalendar.grid.Study populateGridStudy(String studyXML)
        throws Exception {
    edu.northwestern.bioinformatics.studycalendar.grid.Study gridStudy = null;
    try {/*w  w w  . j a va  2s  .  co m*/
        InputStream config = Thread.currentThread().getContextClassLoader().getResourceAsStream(
                "edu/northwestern/bioinformatics/studycalendar/grid/client/client-config.wsdd");
        Reader reader = new StringBufferReader(new StringBuffer(studyXML));
        gridStudy = (edu.northwestern.bioinformatics.studycalendar.grid.Study) Utils.deserializeObject(reader,
                edu.northwestern.bioinformatics.studycalendar.grid.Study.class, config);
    } catch (Exception exception) {
        logger.error("errror while exporting study. genreated study xml:" + studyXML + " message:"
                + exception.getMessage());
        throw new RemoteException(exception.getMessage());
    }
    return gridStudy;
}

From source file:biz.neustar.nexus.plugins.gitlab.client.rest.RestClient.java

/**
 * create a session and retrieve associated {@link GitlabUser}.
 *
 * <pre>//from w w w  .  j  a v a 2 s  . com
 * <code>
 *    curl 'https://gitlabhost/api/v3/session' --data-urlencode 'login=myuser@domain.tld' --data-urlencode 'password=mypassword'
 * </code>
 * </pre>
 *
 * @param userId
 * @param token
 * @return a <code>org.sonatype.security.usermanagement.User</code> from Gitlab by a userid
 * @throws RemoteException
 */
public GitlabUser getUser(String userId, String token) throws RemoteException {
    LOGGER.debug("getUser({}, xxxx)", String.valueOf(userId));

    WebResource r = client.resource(serverURL.resolve("session"));
    try {
        MultivaluedMap<String, String> params = new MultivaluedMapImpl();
        params.add("login", userId);
        params.add("password", token);
        GitlabUser user = r.post(GitlabUser.class, params);
        if (!userIdMatcher.matches(user.getIdentities(), userId)) {
            throw new RemoteException("User Id (" + userId + ") doesn't match");
        }
        return user;
    } catch (UniformInterfaceException uie) {
        throw handleError(uie);
    }
}

From source file:gov.nih.nci.cabig.labviewer.grid.LabViewerRegistrationConsumer.java

public void rollback(Registration registration) throws RemoteException, InvalidRegistrationException {
    log.debug("Received a rollback for participant");
    ParticipantType participant = registration.getParticipant();
    String participantGridId = participant.getGridId();
    String participantExtension = participant.getIdentifier(0).getValue();
    // obtain Connection
    con = dao.getConnection();//from ww  w .  j  a  v a  2 s  .  com
    // method returns the ctominsertdate if the participantGridId is found
    // in the database
    try {
        // check if Participant exists for rollback
        java.util.Date insertdate = dao.checkParticipantForRollback(con, participantGridId,
                participantExtension);
        if (insertdate != null) {
            java.util.Date currdate = new Date();
            long milis1 = insertdate.getTime();
            long milis2 = currdate.getTime();
            long diffInMin = (milis2 - milis1) / MILLIS_PER_MINUTE;

            if (insertdate.before(currdate) && diffInMin < THRESHOLD_MINUTE) {
                // issue Participant roll back
                dao.rollbackParticipant(con, participantGridId, participantExtension);
                log.info("deleted participant");
            } else {
                log.info("There is no participant within the threshold time for rollback");
            }
        } else {
            InvalidRegistrationException ire = new InvalidRegistrationException();
            ire.setFaultString(
                    "Lab Viewer invalid patient rollback message - no patient found with given gridid");
            log.fatal(ire);
            throw (ire);

        }
    } catch (SQLException se) {
        log.error("Error deleting participant", se);
        String msg = "Lab Viewer unable to rollback participant" + se.getMessage();
        throw new RemoteException(msg);
    } finally {
        try {
            con.close();
        } catch (SQLException e) {
            log.error("Error closing connection", e);
        }
    }

}