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.MoteDeploymentConfigurationManagerImpl.java

public void cloneMoteDeploymentConfigurations(int origProjDepConfigID, int newProjDepConfigID)
        throws RemoteException {
    try {//w ww . j  a v a  2s  .  co  m
        List<MoteDeploymentConfiguration> newList;
        newList = new ArrayList<MoteDeploymentConfiguration>();

        readLock.lock();
        try {
            for (MoteDeploymentConfiguration i : moteDepConfigs.values()) {
                if (i.getProjectDeploymentConfigurationID() == origProjDepConfigID) {
                    MoteDeploymentConfiguration mdc = moteDepConfigAdapter.addMoteDeploymentConfiguration(
                            newProjDepConfigID, i.getMoteID(), i.getProgramID(), i.getRadioPowerLevel());
                    newList.add(mdc);
                }
            }
        } finally {
            readLock.unlock();
        }

        writeLock.lock();
        try {
            for (MoteDeploymentConfiguration i : newList) {
                moteDepConfigs.put(i.getID(), i);
            }
        } finally {
            writeLock.unlock();
        }

        for (MoteDeploymentConfiguration i : newList) {
            notifyObservers(Message.NEW_CONFIG, i);
        }
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in cloneMoteDeploymentConfigurations";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

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

@Override
public WSCurationTagHistory[] getCurationTagHistory(String pwId, String timestamp) throws RemoteException {
    try {/*from   w ww .j  a v  a 2 s .c om*/
        String url = baseUrl + "/getCurationTagHistory?pwId=" + pwId;
        if (timestamp != null) {
            url = url + "&timestamp=" + timestamp;
        }
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();
        List<Element> list = root.getChildren("history", WSNamespaces.NS1);
        WSCurationTagHistory[] hist = new WSCurationTagHistory[list.size()];
        for (int i = 0; i < list.size(); i++) {
            hist[i] = Utils.parseCurationTagHistory(list.get(i));
        }
        return hist;
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

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

private ProjectManagerImpl() throws RemoteException {
    super();//  www . jav a 2 s . co m

    try {
        this.managerLock = new ReentrantReadWriteLock(true);
        this.readLock = managerLock.readLock();
        this.writeLock = managerLock.writeLock();
        projectAdapter = AdapterFactory.createProjectAdapter(AdapterType.SQL);
        projects = projectAdapter.readProjects();

        log.debug("Projects read:\n" + projects);
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in ProjectManagerImpl";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

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

public void deleteProjectDeploymentConfig(int id) throws RemoteException {
    try {//from  w  w w  .  ja va2 s .co m
        log.info("Request to delete ProjectDeploymentConfiguration with " + " id:  " + id);

        cleanupProgramProfilingSymbols(id);
        cleanupProgramProfilingMessageSymbols(id);
        cleanupMoteDeploymentConfigurations(id);

        ProjectDeploymentConfiguration config;
        config = projDepConfigAdapter.deleteProjectDeploymentConfig(id);

        writeLock.lock();
        try {
            projDepConfigs.remove(config.getID());
        } finally {
            writeLock.unlock();
        }

        notifyObservers(Message.DELETE_CONFIG, config);
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in deleteProjectDeploymentConfig";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

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

public void deleteProgram(int programID) throws RemoteException {
    try {/* www  . j  a v a  2 s. c  o m*/
        log.info("Deleting program with id  " + programID);

        cleanupProgramMessageSymbols(programID);
        cleanupProgramSymbols(programID);
        cleanupMoteDeploymentConfigurations(programID);

        Program program = programAdapter.deleteProgram(programID);
        writeLock.lock();
        try {
            programs.remove(program.getID());
        } finally {
            writeLock.unlock();
        }

        File sourcePath = new File(program.getSourcePath());

        FileUtils.deleteDirectory(sourcePath);
        FileUtils.cleanupParentDirectories(PROG_ROOT, sourcePath);

        notifyObservers(Message.DELETE_PROGRAM, program);
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (RemoteException ex) {
        throw ex;
    } catch (Exception ex) {
        String msg = "Exception in deleteProgram";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

From source file:it.cnr.icar.eric.service.catalogingTest.cppaCataloging.CPPACataloging.java

public SOAPElement catalogContent(SOAPElement partCatalogContentRequest) throws RemoteException {
    try {/*  w  w w . jav  a  2s  . co m*/
        if (log.isDebugEnabled()) {
            printNodeToConsole(partCatalogContentRequest);
        }

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

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

        Object requestObj = getBindingObjectFromNode(partCatalogContentRequest);

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

        ccReq = (CatalogContentRequest) requestObj;

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

        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);

        transformer.setURIResolver(new URIResolver() {
            public Source resolve(String href, String base) throws TransformerException {
                Source source = null;
                try {
                    // Should this check that href is UUID URN first?
                    source = new StreamSource((repositoryItemDHMap.get(href)).getInputStream());
                } catch (Exception e) {
                    source = null;
                }

                return source;
            }
        });
        transformer.setErrorListener(new ErrorListener() {
            public void error(TransformerException exception) throws TransformerException {
                log.info(exception);
            }

            public void fatalError(TransformerException exception) throws TransformerException {
                log.error(exception);
                throw exception;
            }

            public void warning(TransformerException exception) throws TransformerException {
                log.info(exception);
            }
        });

        //Set respository item as parameter
        transformer.setParameter("repositoryItem", originalContentIT.getId());

        StringWriter sw = new StringWriter();
        transformer.transform(new JAXBSource(jaxbContext, originalContentIT), new StreamResult(sw));

        ccResp = cmsFac.createCatalogContentResponse();

        RegistryObjectListType catalogedMetadata = (RegistryObjectListType) getUnmarshaller()
                .unmarshal(new StreamSource(new StringReader(sw.toString())));
        RegistryObjectListType roList = rimFac.createRegistryObjectListType();
        ccResp.setCatalogedContent(roList);
        // FIXME: Setting catalogedMetadata as CatalogedContent results in incorrect serialization.
        roList.getIdentifiable().addAll(catalogedMetadata.getIdentifiable());

        ccResp.setStatus(CANONICAL_RESPONSE_STATUS_TYPE_ID_Success);

        ccRespElement = getSOAPElementFromBindingObject(ccResp);

        // Copy request's attachments to response to exercise attachment-processing code on client.
        MessageContext mc = servletEndpointContext.getMessageContext();
        mc.setProperty(com.sun.xml.rpc.server.ServerPropertyConstants.SET_ATTACHMENT_PROPERTY,
                (Collection<?>) mc
                        .getProperty(com.sun.xml.rpc.server.ServerPropertyConstants.GET_ATTACHMENT_PROPERTY));

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

    return ccRespElement;
}

From source file:de.willuhn.jameica.hbci.passports.pintan.server.PassportHandleImpl.java

/**
 * @see de.willuhn.jameica.hbci.passport.PassportHandle#open()
 *///from  w  w  w  .  ja v  a2 s .c o  m
public HBCIHandler open() throws RemoteException, ApplicationException {

    if (isOpen())
        return handler;

    Logger.info("open pin/tan passport");
    try {

        if (config == null && this.passport == null)
            throw new ApplicationException(i18n.tr("Keine Konfiguration oder Konto ausgewhlt"));

        if (config == null && this.passport != null && this.passport.getKonto() != null)
            config = PinTanConfigFactory.findByKonto(this.passport.getKonto());

        // Mh, nichts da zum Laden, dann fragen wir mal den User
        if (config == null) {
            GenericIterator list = PinTanConfigFactory.getConfigs();

            if (list == null || list.size() == 0)
                throw new ApplicationException(i18n.tr("Bitte legen Sie zuerst eine PIN/TAN-Konfiguration an"));

            // Wir haben nur eine Config, dann brauchen wir den User nicht fragen
            if (list.size() == 1) {
                config = (PinTanConfig) list.next();
            } else {
                SelectConfigDialog d = new SelectConfigDialog(SelectConfigDialog.POSITION_CENTER, list);
                try {
                    config = (PinTanConfig) d.open();
                } catch (OperationCanceledException oce) {
                    throw oce;
                } catch (Exception e) {
                    Logger.error("error while choosing config", e);
                    throw new ApplicationException(i18n.tr("Fehler bei der Auswahl der PIN/TAN-Konfiguration"));
                }
            }
        }

        if (config == null)
            throw new ApplicationException(i18n.tr("Keine PIN/TAN-Konfiguration fr dieses Konto definiert"));

        Logger.debug("using passport file " + config.getFilename());

        AbstractPlugin plugin = Application.getPluginLoader().getPlugin(HBCI.class);
        HBCICallback callback = ((HBCI) plugin).getHBCICallback();
        if (callback != null && (callback instanceof HBCICallbackSWT))
            ((HBCICallbackSWT) callback).setCurrentHandle(this);

        hbciPassport = config.getPassport();

        {
            AbstractHBCIPassport ap = (AbstractHBCIPassport) hbciPassport;

            // Wir speichern die verwendete PIN/TAN-Config im Passport. Dann wissen wir
            // spaeter in den HBCI-Callbacks noch, aus welcher Config der Passport
            // erstellt wurde. Wird z.Bsp. vom Payment-Server benoetigt.
            ap.setPersistentData(CONTEXT_CONFIG, config);

            String cannationalacc = config.getCustomProperty("cannationalacc");
            if (cannationalacc != null)
                ap.setPersistentData("cannationalacc", cannationalacc);
        }

        String hbciVersion = config.getHBCIVersion();
        if (hbciVersion == null || hbciVersion.length() == 0)
            hbciVersion = HBCIVersion.HBCI_300.getId();

        Logger.info("[PIN/TAN] url         : " + config.getURL());
        Logger.info("[PIN/TAN] blz         : " + config.getBLZ());
        Logger.info("[PIN/TAN] filter      : " + config.getFilterType());
        Logger.info("[PIN/TAN] HBCI version: " + hbciVersion);

        //////////////////////
        // BUGZILLA 831
        // Siehe auch Stefans Mail vom 10.03.2010 - Betreff "Re: [hbci4java] Speicherung des TAN-Verfahrens im PIN/TAN-Passport-File?"
        PtSecMech mech = config.getStoredSecMech();
        String secmech = mech != null ? StringUtils.trimToNull(mech.getId()) : null;

        Logger.info("[PIN/TAN] using stored tan sec mech: " + (mech != null ? mech.toString() : "<ask-user>"));
        ((AbstractPinTanPassport) hbciPassport).setCurrentTANMethod(secmech);
        //////////////////////

        handler = new HBCIHandler(hbciVersion, hbciPassport);
        return handler;
    } catch (RemoteException re) {
        close();
        throw re;
    } catch (ApplicationException ae) {
        close();
        throw ae;
    } catch (OperationCanceledException oce) {
        close();
        throw oce;
    } catch (Exception e) {
        close();
        Logger.error("error while opening pin/tan passport", e);
        throw new RemoteException("error while opening pin/tan passport", e);
    }
}

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

public void cloneProfilingMessageSymbol(int srcConfigID, int newConfigID) throws RemoteException {
    try {//  w  w  w . j  a  v a  2 s .com
        log.info("Request to clone ProgramProfilingMessageSymbol with " + "ConfigID: " + srcConfigID);

        List<ProgramProfilingMessageSymbol> newList;
        newList = new ArrayList<ProgramProfilingMessageSymbol>();

        for (ProgramProfilingMessageSymbol i : ppmSymbols.values()) {
            if (i.getProjectDeploymentConfigurationID() == srcConfigID) {
                ProgramProfilingMessageSymbol ppms = ppmsAdapter.createNewProfilingMessageSymbol(newConfigID,
                        i.getProgramMessageSymbolID());
                newList.add(ppms);
            }
        }

        writeLock.lock();
        try {
            for (ProgramProfilingMessageSymbol i : newList) {
                ppmSymbols.put(i.getID(), i);
            }
        } finally {
            writeLock.unlock();
        }

        for (ProgramProfilingMessageSymbol i : newList) {
            notifyObservers(Message.NEW_SYMBOL, i);
        }
    } catch (AdaptationException ex) {
        throw new RemoteException("AdaptationException", ex);
    } catch (Exception ex) {
        String msg = "Exception in cloneProfilingMessageSymbol";
        log.error(msg, ex);
        throw new RemoteException(msg, ex);
    }
}

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

private ProgramMessageSymbolManagerImpl() throws RemoteException {
    super();//from  w w  w.  ja v  a 2  s  .co m

    try {
        this.managerLock = new ReentrantReadWriteLock(true);
        this.readLock = managerLock.readLock();
        this.writeLock = managerLock.writeLock();
        programMessageSymbolAdapter = AdapterFactory.createProgramMessageSymbolAdapter(AdapterType.SQL);

        programMessageSymbols = programMessageSymbolAdapter.readProgramMessageSymbols();

        log.debug("ProgramMessageSymbols read:\n" + programMessageSymbols);
    } 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);
    }
}

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

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