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, Throwable cause) 

Source Link

Document

Constructs a RemoteException with the specified detail message and cause.

Usage

From source file:gov.nih.nci.cabig.caaers.grid.CaaersStudyConsumer.java

/**
 * This will create a study in the DB. <p/> Assumptions:- Study is identified by Coordinating
 * Center identifier There will only be one Organization assigned identifier in the input, and it
 * is the CoordinatingCenterIdentifier//from ww w  .j a  v  a2 s. co  m
 */
public void createStudy(gov.nih.nci.cabig.ccts.domain.Study studyDto)
        throws RemoteException, InvalidStudyException, StudyCreationException {

    gov.nih.nci.cabig.caaers.domain.Study study = null;
    try {
        logger.info("Begining of studyConsumer : createStudy");

        if (studyDto == null)
            throw getInvalidStudyException("null input");

        OrganizationAssignedIdentifierType idType = (OrganizationAssignedIdentifierType) findOrganizationIdentifier(
                studyDto, OrganizationAssignedIdentifier.COORDINATING_CENTER_IDENTIFIER_TYPE);
        String ccIdentifier = idType.getValue();

        if (!gridServicesAuthorizationHelper
                .authorizedStudyConsumer(idType.getHealthcareSite().getNciInstituteCode())) {
            String message = "Access denied";
            throw getStudyCreationException(message);
        }

        study = fetchStudy(ccIdentifier, OrganizationAssignedIdentifier.COORDINATING_CENTER_IDENTIFIER_TYPE);
        if (study != null) {
            logger.error("Already a study with the same Coordinating Center Identifier (" + ccIdentifier
                    + ") exists.Returning without processing the request.");
            return;
        }

        String coppaIdentifier = findCoppaIdentifier(studyDto);
        if (coppaIdentifier != null) {
            study = new gov.nih.nci.cabig.caaers.domain.RemoteStudy();
        } else {
            study = new gov.nih.nci.cabig.caaers.domain.LocalStudy();
        }
        study.setGridId(studyDto.getGridId());
        populateStudyDetails(studyDto, study, coppaIdentifier);
        studyDao.save(study);
        logger.info("Created the study :" + study.getId());

    } catch (InvalidStudyException e) {
        throw e;
    } catch (StudyCreationException e) {
        throw e;
    } catch (Exception e) {
        logger.error("Error while creating study", e);
        throw new RemoteException("Unable to create study", e);
    }

    //recreate index for the grid-user
    try {
        String gridUserName = GridServicesAuthorizationHelper.getUserNameFromGridIdentity();
        Authentication gridAuthObject = SecurityUtils.createAuthentication(gridUserName, "dummy");
        if (eventFactory != null && study != null)
            eventFactory.publishEntityModifiedEvent(gridAuthObject, study, false); //fire it synchronously
    } catch (Exception e) {
        //log the warning!!!
        logger.warn("Error while recreating the security indexes", e);
    }

    logger.info("End of studyConsumer : createStudy");

}

From source file:com.elasticgrid.examples.video.VideoConverterJSB.java

private void upload(File... files) throws IOException, S3ServiceException {
    // create the destination bucket if needed
    S3Bucket bucket = s3.createBucket(new S3Bucket(destBucketName));
    uploadWatch.startTiming();//from ww w .  ja va 2 s . c om
    // prepare s3 objects
    S3Object[] objects = new S3Object[files.length];
    long bytes = 0;
    for (int i = 0; i < files.length; i++) {
        String key = files[i].getName().replace(".mp4", ".flv");
        logger.log(Level.FINE, "Uploading video ''{0}'' ({1} bytes) into bucket ''{2}'' key ''{3}''...",
                new Object[] { files[i].getAbsolutePath(), files[i].length(), destBucketName, key });
        objects[i] = new S3Object(bucket, key);
        objects[i].setDataInputFile(files[i]);
        objects[i].setContentType("video/x-flv");
        objects[i].setContentLength(files[i].length());
        objects[i].setLastModifiedDate(new Date(files[i].lastModified()));
        bytes += files[i].length();
    }

    // upload the videos
    try {
        long start = System.currentTimeMillis();
        multi.putObjects(bucket, objects);
        long end = System.currentTimeMillis();
        logger.log(Level.INFO,
                "Uploaded {0,choice,1#1 video|1<{0} videos} ({1} bytes) into bucket ''{2}'' in {3}s",
                new Object[] { files.length, bytes, destBucketName, ((end - start) / 1000) });
    } catch (S3ServiceException e) {
        throw new RemoteException("Unexpected error when uploading videos to the remote repository", e);
    }

    uploadWatch.stopTiming();
}

From source file:org.molgenis.wikipathways.client.WikiPathwaysRESTBindingStub.java

@Override
public WSPathwayInfo[] getPathwaysByParentOntologyTerm(String term) throws RemoteException {
    try {/*from   w  w w .j av  a 2 s .co  m*/
        String url = baseUrl + "/getPathwaysByParentOntologyTerm?term=" + term;
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        List<Element> list = root.getChildren("pathways", WSNamespaces.NS1);
        WSPathwayInfo[] info = new WSPathwayInfo[list.size()];
        for (int i = 0; i < list.size(); i++) {
            info[i] = Utils.parseWSPathwayInfo(list.get(i));
        }
        return info;
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

From source file:edu.clemson.cs.nestbed.server.management.instrumentation.ProgramProbeManagerImpl.java

public StaticProgramData getStaticData(Program program) throws RemoteException {
    log.debug("getStaticData called");
    StaticProgramData data = null;/*from   ww w.j  a  v  a  2s . co  m*/

    try {
        data = readStaticData(new File(program.getSourcePath() + "/staticTraceData.dat"));
    } catch (Exception ex) {
        log.error("Exception in getStaticData", ex);
        throw new RemoteException("Exception in getStaticData", ex);
    }

    return data;
}

From source file:com.edmunds.etm.netscaler.NetScalerLoadBalancer.java

@Override
public synchronized void removePoolMember(String serverName, PoolMember member)
        throws PoolMemberNotFoundException, RemoteException {

    final String ipAddress = member.getHostAddress().getIpAddress();
    final String serviceName = "ip_" + ipAddress;

    try {/*from  w w  w  .ja v  a2  s.c om*/
        final NsServer nsServer;
        nsServer = nitroService.getServers().get(serviceName);
        nsServer.delete();
    } catch (NitroExceptionNoSuchResource e) {
        throw new PoolMemberNotFoundException(serviceName, e);
    } catch (NitroException e) {
        throw new RemoteException("Delete Pool Member Failed", e);
    }
}

From source file:org.molgenis.wikipathways.client.WikiPathwaysRESTBindingStub.java

@Override
public WSPathwayHistory getPathwayHistory(String pwId, String timestamp) throws RemoteException {
    try {/*from ww w.  j av  a 2s  . c  o m*/
        String url = baseUrl + "/getPathwayHistory?pwId=" + pwId + "&timestamp=" + timestamp;
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        Element hist = root.getChild("history", WSNamespaces.NS1);
        return Utils.parsePathwayHistory(hist);
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

From source file:org.molgenis.wikipathways.client.WikiPathwaysRESTBindingStub.java

@Override
public WSPathwayInfo getPathwayInfo(String pwId) throws RemoteException {
    try {//w w  w  .  jav  a2s. c  om
        String url = baseUrl + "/getPathwayInfo?pwId=" + pwId;
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        Element p = root.getChild("pathwayInfo", WSNamespaces.NS1);
        return Utils.parseWSPathwayInfo(p);
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSMDMConfig getMDMConfiguration() throws RemoteException {
    WSMDMConfig mdmConfig = new WSMDMConfig();
    Properties property = MDMConfiguration.getConfiguration();
    try {/*  w w w . ja va 2  s .c o  m*/
        mdmConfig.setServerName(property.getProperty("xmldb.server.name")); //$NON-NLS-1$
        mdmConfig.setServerPort(property.getProperty("xmldb.server.port")); //$NON-NLS-1$
        mdmConfig.setUserName(property.getProperty("admin.user")); //$NON-NLS-1$
        mdmConfig.setPassword(property.getProperty("admin.password")); //$NON-NLS-1$
        mdmConfig.setXdbDriver(property.getProperty("xmldb.driver")); //$NON-NLS-1$
        mdmConfig.setXdbID(property.getProperty("xmldb.dbid")); //$NON-NLS-1$
        mdmConfig.setXdbUrl(property.getProperty("xmldb.dburl")); //$NON-NLS-1$
        mdmConfig.setIsupurl(property.getProperty("xmldb.isupurl")); //$NON-NLS-1$
    } catch (Exception e) {
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
    return mdmConfig;
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSDataModel getDataModel(WSGetDataModel wsGetDataModel) throws RemoteException {
    try {/*from   www  .java  2s .  c o m*/
        return XConverter.VO2WS(Util.getDataModelCtrlLocal()
                .getDataModel(new DataModelPOJOPK(wsGetDataModel.getWsDataModelPK().getPk())));
    } catch (Exception e) {
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:org.molgenis.wikipathways.client.WikiPathwaysRESTBindingStub.java

@Override
public WSPathwayInfo[] getRecentChanges(String timestamp) throws RemoteException {
    try {//from  ww w.j  av a2  s  .  c  o m
        String url = baseUrl + "/getRecentChanges?timestamp=" + timestamp;
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        List<Element> list = root.getChildren("pathways", WSNamespaces.NS1);
        WSPathwayInfo[] info = new WSPathwayInfo[list.size()];
        for (int i = 0; i < list.size(); i++) {
            info[i] = Utils.parseWSPathwayInfo(list.get(i));
        }
        return info;
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}