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:edu.clemson.cs.nestbed.server.management.configuration.ProgramManagerImpl.java

private ProgramManagerImpl() throws RemoteException {
    super();//  ww  w. ja v  a 2 s.  com

    try {
        this.managerLock = new ReentrantReadWriteLock(true);
        this.readLock = managerLock.readLock();
        this.writeLock = managerLock.writeLock();
        this.programAdapter = AdapterFactory.createProgramAdapter(AdapterType.SQL);
        this.programs = programAdapter.readPrograms();
        log.debug("Programs read:\n" + programs);
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    }
}

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

/**
 * 1. Fetch the study based on Coordinating center Identifier 2. Fetch the Organization to which
 * the participant is registered/*from  ww  w .  j  a v a  2 s.c  o m*/
 */
// @Transactional(readOnly=false)
public Registration register(Registration registration)
        throws RemoteException, InvalidRegistrationException, RegistrationConsumptionException {
    logger.info("Begining of registration-register");
    System.out.println("-- RegistrationConsumer : register");

    OrganizationAssignedIdentifierType ccIdentifierType = (OrganizationAssignedIdentifierType) findCoordinatingCenterIdentifier(
            registration);
    String ccIdentifier = ccIdentifierType.getValue();

    boolean associatedToCC = false;
    boolean associatedToSS = false;
    Participant participant = null;
    try {
        associatedToCC = gridServicesAuthorizationHelper.authorizedRegistrationConsumer(
                ccIdentifierType.getHealthcareSite().getNciInstituteCode(), ccIdentifierType.getValue());
        associatedToSS = gridServicesAuthorizationHelper.authorizedRegistrationConsumer(
                registration.getStudySite().getHealthcareSite(0).getNciInstituteCode(),
                ccIdentifierType.getValue());

        if (!(associatedToCC || associatedToSS)) {
            String message = "Access denied";
            RegistrationConsumptionException exp = getRegistrationConsumptionException(message);
            throw exp;
        }

        Study study = fetchStudy(ccIdentifier,
                OrganizationAssignedIdentifier.COORDINATING_CENTER_IDENTIFIER_TYPE);

        if (study == null) {
            String message = "Study identified by Coordinating Center Identifier '" + ccIdentifier
                    + "' doesn't exist";
            RegistrationConsumptionException exp = getRegistrationConsumptionException(message);
            throw exp;
        }
        String siteNCICode = registration.getStudySite().getHealthcareSite(0).getNciInstituteCode();
        StudySite site = findStudySite(study, siteNCICode);
        if (site == null) {
            StringBuilder message = new StringBuilder("The study '").append(study.getShortTitle())
                    .append("', identified by Coordinating Center Identifier '").append(ccIdentifier)
                    .append("' is not associated to a site identified by NCI code :'").append(siteNCICode)
                    .append("'");

            throw getRegistrationConsumptionException(message.toString());

        }
        Boolean dataEntryStatus = study.getDataEntryStatus();
        if (dataEntryStatus == null || !dataEntryStatus) {
            String message = "Study identified by Coordinating Center Identifier '" + ccIdentifier
                    + "' is not open , Please login to caAERS , complete the Study details and open the Study";
            RegistrationConsumptionException exp = getRegistrationConsumptionException(message);
            throw exp;
        }

        //find the subject identifier.
        IdentifierType subjectIdentifierType = findSubjectIdentifierType(
                registration.getParticipant().getIdentifier(), site);

        //find the identifier to query on
        String subjectIdValue = subjectIdentifierType == null
                ? findMedicalRecordNumber(registration.getParticipant())
                : subjectIdentifierType.getValue();

        //fetch the participant
        participant = fetchParticipant(subjectIdValue, site);

        if (participant == null) {
            participant = createParticipant(registration, createSubjectIdentifier(subjectIdValue, site));
        }
        createStudyParticipantAssignment(registration.getGridId(), participant, site,
                registration.getIdentifier());
        participantDao.save(participant);

    } catch (InvalidRegistrationException e) {
        throw e;
    } catch (RegistrationConsumptionException e) {
        throw e;
    } catch (Exception e) {
        logger.error("Error while registering", e);
        throw new RemoteException("Error while registering", e);
    }

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

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

@Override
public WSOntologyTerm[] getOntologyTermsByPathway(String pwId) throws RemoteException {
    try {/*from  w ww .  java 2  s.c  o  m*/
        String url = baseUrl + "/getOntologyTermsByPathway?pwId=" + pwId;
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        List<Element> list = root.getChildren("terms", WSNamespaces.NS1);
        WSOntologyTerm[] terms = new WSOntologyTerm[list.size()];
        for (int i = 0; i < list.size(); i++) {
            terms[i] = Utils.parseOntologyTerm(list.get(i));
        }
        return terms;
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

From source file:edu.clemson.cs.nestbed.server.management.configuration.MoteDeploymentConfigurationManagerImpl.java

public void deleteMoteDeploymentConfigWithProjectDepConfID(int pdcID) throws RemoteException {
    log.info("Request to delete MoteDeploymentConfiguration with " + "ProjectDeploymentConfigurationID: "
            + pdcID);//from  w  w w  .jav  a 2s . c  om

    try {
        List<MoteDeploymentConfiguration> list;
        list = new ArrayList<MoteDeploymentConfiguration>(moteDepConfigs.values());
        for (MoteDeploymentConfiguration i : list) {
            if (i.getProjectDeploymentConfigurationID() == pdcID) {
                deleteMoteDeploymentConfiguration(i.getID());
            }
        }
    } catch (RemoteException ex) {
        throw ex;
    } catch (Exception ex) {
        String msg = "Exception in deleteMoteDeploymentConfiguration";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

From source file:edu.clemson.cs.nestbed.server.management.configuration.ProgramProfilingMessageSymbolManagerImpl.java

public void deleteProgProfMsgSymsFor(int programMessageSymbolID) throws RemoteException {
    log.info("Request to delete ProgramProfilingMessageSymbol for " + "programMessageSymbolID: "
            + programMessageSymbolID);//from ww  w . j  a va 2  s  . com

    try {
        List<ProgramProfilingMessageSymbol> list;
        list = new ArrayList<ProgramProfilingMessageSymbol>(ppmSymbols.values());

        for (ProgramProfilingMessageSymbol i : list) {
            if (i.getProgramMessageSymbolID() == programMessageSymbolID) {
                deleteProgramProfilingMessageSymbol(i.getID());
            }
        }
    } catch (RemoteException ex) {
        throw ex;
    } catch (Exception ex) {
        String msg = "Exception in deleteProgProfMsgSymsFor";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

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

public Map<String, List<String>> getModuleFunctionListMap(int programID) throws RemoteException {
    log.debug("getModuleFunctionListMap called");

    try {/*  w ww .j  a  va  2  s . c o  m*/
        Program program = programManager.getProgram(programID);
        File makefile = new File(program.getSourcePath(), "Makefile");
        String topLevelConfiguration = programWeaverManager.findComponentFromMakefile(makefile);

        log.info("Top-level config: " + topLevelConfiguration);

        File topLevelFile = new File(program.getSourcePath(), topLevelConfiguration + ".nc").getAbsoluteFile();
        File analysisDir = new File(program.getSourcePath()).getAbsoluteFile();

        log.info("Top-Level file:    " + topLevelFile.getAbsolutePath());
        log.info("Basedir directory: " + analysisDir.getAbsolutePath());

        NescToolkit toolkit = new NescToolkit(topLevelFile, analysisDir);

        toolkit.prependIncludePath(NESTBED_NESC_ROOT + "/ModifiedTinyOS");
        toolkit.addIncludePath(NESTBED_NESC_ROOT + "/TraceRecorder");
        toolkit.addIncludePath(NESTBED_NESC_ROOT + "/MemoryProfiler");
        toolkit.addIncludePath(NESTBED_NESC_ROOT + "/NestbedControl");

        toolkit.appendGccArgument("-I");
        toolkit.appendGccArgument(NESTBED_NESC_ROOT + "/ModifiedTinyOS");
        toolkit.appendGccArgument("-I");
        toolkit.appendGccArgument(NESTBED_NESC_ROOT + "/TraceRecorder");
        toolkit.appendGccArgument("-I");
        toolkit.appendGccArgument(NESTBED_NESC_ROOT + "/MemoryProfiler");
        toolkit.appendGccArgument("-I");
        toolkit.appendGccArgument(NESTBED_NESC_ROOT + "/NestbedControl");

        toolkit.load();

        Map<String, SourceFile> sourceFiles = toolkit.getSourceFileMap();

        return AstUtils.buildModuleFunctionListMap(sourceFiles);
    } catch (Exception ex) {
        throw new RemoteException("Exception:", ex);
    }
}

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

@Override
public WSPathway getPathway(String pwId, int revision) throws RemoteException {
    try {//from   w w w .  java  2  s. c  o  m
        String url = baseUrl + "/getPathway?pwId=" + pwId;
        if (revision != 0) {
            url = url + "&revision=" + revision;
        }
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        Element p = root.getChild("pathway", WSNamespaces.NS1);
        return Utils.parsePathway(p);
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

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

@Override
public synchronized void deleteVirtualServer(VirtualServer server)
        throws VirtualServerNotFoundException, RemoteException {

    for (PoolMember poolMember : server.getPoolMembers()) {
        try {/*from  w  w  w  .  ja va 2  s.co m*/
            removePoolMember(server.getName(), poolMember);
        } catch (PoolMemberNotFoundException e) {
        }
    }

    try {
        nitroService.getVirtualServers().get(server.getName()).delete();
    } catch (NitroExceptionNoSuchResource e) {
        throw new VirtualServerNotFoundException(server.getName(), e);
    } catch (NitroException e) {
        throw new VirtualServerNotFoundException("Delete Virtual Server Failed", e);
    }

    addressPool.releaseAddress(server.getHostAddress().getIpAddress());

    final String monitorName = getMonitorName(server.getName());
    try {
        nitroService.getMonitors().get(monitorName).delete();
    } catch (NitroExceptionNoSuchResource e) {
        log.info("Monitor does not exist: " + monitorName);
    } catch (NitroException e) {
        throw new RemoteException("Delete Monitor Failed", e);
    }
}

From source file:edu.clemson.cs.nestbed.server.management.configuration.ProgramProfilingMessageSymbolManagerImpl.java

public void deleteProfilingMessageSymbolWithProjectDepConfID(int pdcID) throws RemoteException {
    log.info("Request to delete ProgramProfilingMessageSymbol for " + "ProjectDeploymentConfigurationID: "
            + pdcID);/*w  ww .j a  v  a  2  s .  co m*/

    try {
        List<ProgramProfilingMessageSymbol> list;
        list = new ArrayList<ProgramProfilingMessageSymbol>(ppmSymbols.values());

        for (ProgramProfilingMessageSymbol i : list) {
            if (i.getProjectDeploymentConfigurationID() == pdcID) {
                deleteProgramProfilingMessageSymbol(i.getID());
            }
        }
    } catch (RemoteException ex) {
        throw ex;
    } catch (Exception ex) {
        String msg = "Exception in " + "deleteProfilingMessageSymbolWithProjectDepConfID";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

From source file:edu.clemson.cs.nestbed.server.management.configuration.ProgramProfilingSymbolManagerImpl.java

public void updateProgramProfilingSymbol(int id, int configID, int programSymbolID) throws RemoteException {
    try {/*from  w  ww.  java2  s.com*/
        ProgramProfilingSymbol pps = progProfSymbols.get(id);

        if (pps != null) {
            log.info("Updating existing program profiling symbol");

            pps = progProfSymbolAdapter.updateProgramProfilingSymbol(id, configID, programSymbolID);
            writeLock.lock();
            try {
                progProfSymbols.put(pps.getID(), pps);
            } finally {
                writeLock.unlock();
            }

            notifyObservers(Message.NEW_SYMBOL, pps);
        } else {
            log.error("Unable to update symbol with id: " + id);
        }
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in updateProgramProfilingSymbol";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}