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:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSBoolean existsDataModel(WSExistsDataModel wsExistsDataModel) throws RemoteException {
    try {// ww  w . j  a v a  2s  . c  o  m
        return new WSBoolean((Util.getDataModelCtrlLocal()
                .existsDataModel(new DataModelPOJOPK(wsExistsDataModel.getWsDataModelPK().getPk())) != null));
    } 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 String getUserByOrcid(String orcid) throws RemoteException {
    try {//ww w.j av a 2 s .  co  m
        String url = baseUrl + "/getUserByOrcid?orcid=" + orcid;
        Document jdomDocument = Utils.connect(url, client);
        Element root = jdomDocument.getRootElement();

        return root.getChildText("Result", WSNamespaces.NS1).substring(5);
    } catch (Exception e) {
        throw new RemoteException(e.getMessage(), e.getCause());
    }
}

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

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

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

@Override
public WSDataModelPKArray getDataModelPKs(WSRegexDataModelPKs regexp) throws RemoteException {
    try {/*  w ww  .  ja va  2  s  . c om*/
        WSDataModelPKArray array = new WSDataModelPKArray();
        Collection<DataModelPOJOPK> list = Util.getDataModelCtrlLocal().getDataModelPKs(regexp.getRegex());
        ArrayList<WSDataModelPK> wsList = new ArrayList<WSDataModelPK>();
        for (DataModelPOJOPK pk : list) {
            WSDataModelPK wsPK = new WSDataModelPK(pk.getUniqueId());
            wsList.add(wsPK);
        }
        array.setWsDataModelPKs(wsList.toArray(new WSDataModelPK[list.size()]));
        return array;
    } catch (Exception e) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(e.getMessage(), e);
        }
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

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

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

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

@Override
public WSDataModelPK deleteDataModel(WSDeleteDataModel wsDeleteDataModel) throws RemoteException {
    try {/*from  w w  w .ja  va  2s .  c  o  m*/
        return new WSDataModelPK(Util.getDataModelCtrlLocal()
                .removeDataModel(new DataModelPOJOPK(wsDeleteDataModel.getWsDataModelPK().getPk()))
                .getUniqueId());
    } catch (Exception e) {
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:com.silverpeas.tags.navigation.MenuTag.java

/**
 * Construction de l'url de l'item./*from w ww  . j a va2s.  c o  m*/
 * @param node
 * @param prefixId
 * @return
 * @throws RemoteException
 */
private String generateFullSemanticPath(NodeDetail node, String prefixId) throws RemoteException {
    try {
        return LinkGeneratorFactory.getInstance().newLinkGenerator().generateFullSemanticPath(pageContext,
                themetracker, node, idTopicRoot, null, prefixId);
    } catch (Exception e) {
        throw new RemoteException("", e);
    }
}

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

@Override
public WSPathwayInfo[] listPathways(String organism) throws RemoteException {
    try {/*from   w w w  . ja v a 2 s .  co m*/
        String url = "";
        if (organism == null) {
            url = baseUrl + "/listPathways";
        } else {
            organism = organism.replace(" ", "+");
            url = baseUrl + "/listPathways?organism=" + organism;
        }
        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:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSString checkSchema(WSCheckSchema wsSchema) throws RemoteException {
    try {/*from w w w. ja  va  2s  .c  o m*/
        return new WSString(Util.getDataModelCtrlLocal().checkSchema(wsSchema.getSchema()));
    } catch (Exception e) {
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:gov.loc.www.zing.srw.srw_bindings.SRWSoapBindingImpl.java

public SearchRetrieveResponseType searchRetrieveOperation(SearchRetrieveRequestType request)
        throws RemoteException {
    log.debug("Enter: searchRetrieveOperation");
    if (log.isInfoEnabled()) {
        log.info("request: maximumRecords:" + request.getMaximumRecords() + " query:" + request.getQuery()
                + " recordPacking:" + request.getRecordPacking() + " recordSchema:" + request.getRecordSchema()
                + " recordXpath:" + request.getRecordXPath() + " sortKeys:" + request.getSortKeys()
                + " startRecord:" + request.getStartRecord() + " stylesheet:" + request.getStylesheet()
                + " version:" + request.getVersion());
    }/*  w  w w  . ja v  a2  s . c o  m*/
    long startTime = System.currentTimeMillis();
    MessageContext msgContext = MessageContext.getCurrentContext();
    SearchRetrieveResponseType response;
    int resultSetIdleTime = ((Integer) msgContext.getProperty("resultSetIdleTime")).intValue();
    NonNegativeInteger nni = request.getResultSetTTL();
    if (log.isDebugEnabled())
        log.debug("resultSetTTL()=" + nni);
    if (nni != null) {
        int ttl = nni.intValue();
        log.debug("ttl=" + ttl);
        if (ttl < resultSetIdleTime)
            resultSetIdleTime = ttl;
    }
    String dbname = (String) msgContext.getProperty("dbname");
    SRWDatabase db = (SRWDatabase) msgContext.getProperty("db");
    if (log.isDebugEnabled())
        log.debug("db=" + db);

    String sortKeys = request.getSortKeys();
    if (sortKeys != null)
        request.setSortKeys(sortKeys);

    String query = request.getQuery();
    if (query.indexOf('%') >= 0)
        try {
            request.setQuery(java.net.URLDecoder.decode(query, "utf-8"));
        } catch (java.io.UnsupportedEncodingException e) {
        }
    if (query == null) {
        response = new SearchRetrieveResponseType();
        db.diagnostic(SRWDiagnostic.MandatoryParameterNotSupplied, "query", response);
    } else if (request.getStartRecord() != null && request.getStartRecord().intValue() == Integer.MAX_VALUE) {
        response = new SearchRetrieveResponseType();
        db.diagnostic(SRWDiagnostic.UnsupportedParameterValue, "startRecord", response);
    } else if (request.getMaximumRecords() != null
            && request.getMaximumRecords().intValue() == Integer.MAX_VALUE) {
        response = new SearchRetrieveResponseType();
        db.diagnostic(SRWDiagnostic.UnsupportedParameterValue, "maximumRecords", response);
    } else if (request.getResultSetTTL() != null && request.getResultSetTTL().intValue() == Integer.MAX_VALUE) {
        response = new SearchRetrieveResponseType();
        db.diagnostic(SRWDiagnostic.UnsupportedParameterValue, "resultSetTTL", response);
    } else
        try {
            response = db.doRequest(request);
            if (response == null) {
                response = new SearchRetrieveResponseType();
                response.setVersion("1.1");
                setEchoedSearchRetrieveRequestType(request, response);
                db.diagnostic(SRWDiagnostic.GeneralSystemError, null, response);
                return response;
            }
            if (msgContext.getProperty("sru") != null && request.getStylesheet() != null) // you can't ask for a stylesheet in srw!
                db.diagnostic(SRWDiagnostic.StylesheetsNotSupported, null, response);

            setEchoedSearchRetrieveRequestType(request, response);
            if (request.getRecordXPath() != null)
                db.diagnostic(72, null, response);
            if (request.getSortKeys() != null && !request.getSortKeys().equals("") && !db.supportsSort())
                db.diagnostic(SRWDiagnostic.SortNotSupported, null, response);

            // set extraResponseData
            StringBuffer extraResponseData = new StringBuffer();

            // we're going to stick the database name in extraResponseData every time
            if (db.databaseTitle != null)
                extraResponseData.append("<databaseTitle>").append(db.databaseTitle).append("</databaseTitle>");
            else
                extraResponseData.append("<databaseTitle>").append(dbname).append("</databaseTitle>");

            // did they ask for the targetURL to be returned?
            Hashtable extraRequestDataElements = SRWDatabase.parseElements(request.getExtraRequestData());
            String s = (String) extraRequestDataElements.get("returnTargetURL");
            log.info("returnTargetURL=" + s);
            if (s != null && !s.equals("false")) {
                String targetStr = (String) msgContext.getProperty("targetURL");
                log.info("targetStr=" + targetStr);
                if (targetStr != null && targetStr.length() > 0) {
                    URL target = new URL(targetStr);
                    extraResponseData.append("<targetURL>").append("<host>").append(target.getHost())
                            .append("</host>").append("<port>").append(target.getPort()).append("</port>")
                            .append("<path>").append(target.getPath()).append("</path>").append("<query>")
                            .append(Utilities.xmlEncode(target.getQuery())).append("</query>")
                            .append("</targetURL>");
                }
            }

            // set extraResponseData
            SRWDatabase.setExtraResponseData(response, extraResponseData.toString());
        } catch (Exception e) {
            log.error(e, e);
            throw new RemoteException(e.getMessage(), e);
        } finally {
            SRWDatabase.putDb(dbname, db);
        }

    response.setVersion("1.1");
    log.info("\"" + query + "\"==>" + response.getNumberOfRecords() + " ("
            + (System.currentTimeMillis() - startTime) + "ms)");
    log.debug("Exit: searchRetrieveOperation");
    return response;
}