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:biz.neustar.nexus.plugins.gitlab.client.rest.RestClient.java

private RemoteException handleError(UniformInterfaceException uie) {
    ClientResponse response = uie.getResponse();
    String error = response.getEntity(String.class);
    if (StringUtils.isNotBlank(error)) {
        LOGGER.error(GitlabAuthenticatingRealm.GITLAB_MSG + "Error: {}", error);
    }/*w  w w.  j  av  a2  s. c  om*/
    return new RemoteException("Error in a Gitlab REST call", uie);
}

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

@Override
public WSSearchResult[] findPathwaysByXref(String[] ids, String[] codes) throws RemoteException {
    try {//from  w  w  w.j a  va 2s .  c om
        String url = baseUrl + "/findPathwaysByXref";
        int count = 0;
        for (String i : ids) {
            if (count == 0) {
                url = url + "?ids=" + i;
                count++;
            } else {
                url = url + "&ids=" + i;
            }
        }
        for (String c : codes) {
            url = url + "&codes=" + c;
        }

        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        List<Element> list = root.getChildren("result", WSNamespaces.NS1);
        WSSearchResult[] res = new WSSearchResult[list.size()];
        for (int i = 0; i < list.size(); i++) {
            res[i] = Utils.parseWSSearchResult(list.get(i));
        }
        return res;
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

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

public void setMoteDeploymentConfiguration(int projectDepConfID, int moteID, int programID, int radioPowerLevel)
        throws RemoteException {
    writeLock.lock();/* ww  w  .  ja  v  a2 s.  c o m*/
    try {
        MoteDeploymentConfiguration mdc;
        mdc = findMoteDeploymentConfiguration(projectDepConfID, moteID);

        if (mdc != null) {
            log.info("Updating existing mote deployment configuration");
            mdc = moteDepConfigAdapter.updateMoteDeploymentConfiguration(mdc.getID(), programID,
                    radioPowerLevel);
        } else {
            log.info("Adding new mote deployment configuration");
            mdc = moteDepConfigAdapter.addMoteDeploymentConfiguration(projectDepConfID, moteID, programID,
                    radioPowerLevel);
        }

        moteDepConfigs.put(mdc.getID(), mdc);
        notifyObservers(Message.NEW_CONFIG, mdc);
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in setMoteDeploymentConfiguration";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    } finally {
        writeLock.unlock();
    }
}

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

public String findComponentFromMakefile(File makefile) throws RemoteException {
    String component = null;/*w  ww  .j  av a  2s .  c o  m*/
    Scanner scanner = null;

    try {
        log.debug("Makefile:  " + makefile);
        scanner = new Scanner(makefile);

        while (scanner.hasNext() && component == null) {
            String line = scanner.nextLine();
            String regExp = "^COMPONENT=(\\S+)";
            Pattern pattern = Pattern.compile(regExp);
            Matcher matcher = pattern.matcher(line);

            if (matcher.find()) {
                component = matcher.group(1);
            }
        }
    } catch (FileNotFoundException fnfe) {
        throw new RemoteException("FileNotFoundException", fnfe);
    } finally {
        try {
            scanner.close();
        } catch (Exception ex) {
            /* empty */ }
    }

    if (component == null) {
        // FIXME:  Shouldn't be throwing generic Exceptions
        throw new RemoteException("No main component found in Makefile.");
    }

    return component;
}

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

public void createNewProfilingSymbol(int configID, int programSymbolID) throws RemoteException {
    try {/*ww  w .  ja  v  a  2 s.  c  o m*/
        log.info("Request to create new ProgramProfilingSymbol:\n" + "  projectDeploymentConfigurationID:  "
                + configID + "\n" + "  programSymbolID:                   " + programSymbolID);

        ProgramProfilingSymbol profilingSymbol = progProfSymbolAdapter.createNewProfilingSymbol(configID,
                programSymbolID);

        writeLock.lock();
        try {
            progProfSymbols.put(profilingSymbol.getID(), profilingSymbol);
        } finally {
            writeLock.unlock();
        }

        notifyObservers(Message.NEW_SYMBOL, profilingSymbol);
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in createNewProfilingSymbol";
        throw new RemoteException(msg, ex);
    }
}

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

private void cleanupPrograms(int projectID) throws RemoteException {
    ProgramManager pm = ProgramManagerImpl.getInstance();

    try {/*from   ww w.jav  a2  s  .c o  m*/
        List<Program> list = pm.getProgramList(projectID);
        list = new ArrayList<Program>(list);

        for (Program i : list) {
            pm.deleteProgram(i.getID());
        }
    } catch (RemoteException ex) {
        throw ex;
    } catch (Exception ex) {
        String msg = "Exception in cleanupPrograms";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

From source file:it.cnr.icar.eric.service.validationTest.cppaValidation.CPPAValidation.java

public SOAPElement validateContent(SOAPElement partValidateContentRequest) throws RemoteException {
    try {//from w  w  w  .  java 2  s  . co  m
        if (log.isDebugEnabled()) {
            printNodeToConsole(partValidateContentRequest);
        }

        HashMap<String, DataHandler> repositoryItemDHMap = getRepositoryItemDHMap();

        if (log.isDebugEnabled()) {
            log.debug("Attachments: " + repositoryItemDHMap.size());
        }

        Object requestObj = getBindingObjectFromNode(partValidateContentRequest);

        if (!(requestObj instanceof ValidateContentRequest)) {
            throw new Exception(
                    "Wrong response received from validation service.  Expected ValidationContentRequest, got: "
                            + partValidateContentRequest.getElementName().getQualifiedName());
        }

        vcReq = (ValidateContentRequest) requestObj;

        IdentifiableType originalContentIT = vcReq.getOriginalContent().getIdentifiable().get(0).getValue();
        IdentifiableType invocationControlIT = vcReq.getInvocationControlFile().get(0);

        DataHandler originalContentDH = repositoryItemDHMap.get(originalContentIT.getId());
        DataHandler invocationControlDH = repositoryItemDHMap.get(invocationControlIT.getId());

        if (log.isDebugEnabled()) {
            log.debug("originalContentIT id: " + originalContentIT.getId());
            log.debug("invocationControlIT id: " + invocationControlIT.getId());
        }

        StreamSource invocationControlSrc = new StreamSource(invocationControlDH.getInputStream());

        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(invocationControlSrc);

        StringWriter sw = new StringWriter();
        transformer.transform(new StreamSource(originalContentDH.getInputStream()), new StreamResult(sw));

        vcResp = cmsFac.createValidateContentResponse();

        boolean success = Boolean.valueOf(sw.toString()).booleanValue();

        if (success) {
            vcResp.setStatus(CANONICAL_RESPONSE_STATUS_TYPE_ID_Success);
        } else {
            RegistryError re = rsFac.createRegistryError();
            re.setValue(sw.toString());
            re.setCodeContext(errorCodeContext);
            re.setErrorCode("InvalidContentException");

            RegistryErrorList el = rsFac.createRegistryErrorList();
            el.getRegistryError().add(re);
            el.setHighestSeverity("Failure");

            vcResp.setStatus(CANONICAL_RESPONSE_STATUS_TYPE_ID_Failure);
            vcResp.setRegistryErrorList(el);
        }

        vcRespElement = getSOAPElementFromBindingObject(vcResp);
    } catch (Exception e) {
        throw new RemoteException("Could not create response.", e);
    }

    return vcRespElement;
}

From source file:edu.clemson.cs.nestbed.server.management.profiling.NucleusManagerImpl.java

public boolean setSymbol(int value, int id, String sourcePath, String moteType, String moteSerialID)
        throws RemoteException {
    boolean okay = false;

    try {/*from  www . j  a v a 2  s.c om*/
        String device = "/dev/motes/" + moteSerialID;
        log.info("Setting symbol on device: " + device + " to value " + value);

        ProgramProfilingSymbol pps;
        ProgramSymbol programSymbol;
        String moduleName;
        String symbolName;

        pps = ProgramProfilingSymbolManagerImpl.getInstance().getProgramProfilingSymbol(id);
        programSymbol = ProgramSymbolManagerImpl.getInstance().getProgramSymbol(pps.getProgramSymbolID());
        moduleName = programSymbol.getModule();
        symbolName = programSymbol.getSymbol();

        if (!moduleName.equals("<global>")) {
            symbolName = moduleName + "." + symbolName;
        }
        log.info("Set symbol: " + symbolName + " to " + value);

        String source = "serial@" + device + ":telos";
        PhoenixSource phoenix = BuildSource.makePhoenix(source, logMessenger);
        MoteIF moteIF = new MoteIF(phoenix);
        MemoryProfilingMessage payload = new MemoryProfilingMessage();

        payload.set_read((byte) 0);
        payload.set_offset((byte) 0);
        payload.set_address(programSymbol.getAddress());
        payload.set_size(programSymbol.getSize());
        payload.set_value(value);

        moteIF.send(0, payload);
        phoenix.shutdown();

        okay = true;
    } catch (IOException ex) {
        String msg = "Exception in setSymbol";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
    return okay;
}

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

@Override
public synchronized Map<String, AvailabilityStatus> getAvailabilityStatus(List<String> serverNames)
        throws VirtualServerNotFoundException, RemoteException {

    try {/*from w ww.  j  a  va  2 s .  c om*/
        final String[] namesArray = serverNames.toArray(new String[serverNames.size()]);

        final Map<String, NsVirtualServer> virtualServers = nitroService.getVirtualServers().get(namesArray)
                .stream().collect(toMap(NsVirtualServer::getName, x -> x));

        return serverNames.stream().collect(toMap(x -> x, x -> getAvailabilityStatus(virtualServers.get(x))));
    } catch (NitroExceptionNoSuchResource e) {
        // Probably won't happen.
        throw new VirtualServerNotFoundException("Get availability status failed", e);
    } catch (NitroException e) {
        throw new RemoteException("Get availability status failed", e);
    }
}

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

public void deleteProgramMessageSymbol(int id) throws RemoteException {
    try {/* w  ww  . j  a  va  2 s .co  m*/
        ProgramMessageSymbol pmt;
        log.info("Deleting program message symbol with id: " + id);

        cleanupProgramProfilingMessageSymbols(id);

        writeLock.lock();
        try {
            pmt = programMessageSymbolAdapter.deleteProgramMessageSymbol(id);
            programMessageSymbols.remove(pmt.getID());
        } finally {
            writeLock.unlock();
        }

        // notifyObservers(..., pmt);
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in addProgramMessageSymbol";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}