Example usage for java.rmi ServerException getMessage

List of usage examples for java.rmi ServerException getMessage

Introduction

In this page you can find the example usage for java.rmi ServerException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message, including the message from the cause, if any, of this exception.

Usage

From source file:com.amalto.workbench.editors.DataClusterComposite.java

protected boolean refreshData() {
    try {//from   w w  w . j  a  v  a2s . co m
        if (conceptCombo.isDisposed()) {
            return false;
        }
        if (getXObject().getEndpointAddress() == null) {
            return false;
        }
        TMDMService service = Util.getMDMService(getXObject());

        WSDataCluster cluster = null;
        if (getXObject().getWsObject() == null) { // then fetch from server
            cluster = service.getDataCluster(new WSGetDataCluster((WSDataClusterPK) getXObject().getWsKey()));
            getXObject().setWsObject(cluster);
        } else { // it has been opened by an editor - use the object there
            // added for TMDM-3064
            // the following may throw ServerException to identify the data continer not exist on the server
            cluster = service.getDataCluster(new WSGetDataCluster(new WSDataClusterPK(getXObject().getName())));
            // if you could go to next line, that means the data container is on the server specified
            cluster = (WSDataCluster) getXObject().getWsObject();

        }

        // add by myli; fix the bug:0013077: if the data is too much, just get the entities from the model instead
        // of from the container.

        String clusterName = URLEncoder.encode(cluster.getName(), "utf-8");//$NON-NLS-1$

        //            WSString countStr = port.count(new WSCount(new WSDataClusterPK(cluster.getName()), "*", null, 100)); //$NON-NLS-1$
        // long count = Long.parseLong(countStr.getValue());

        WSStringArray conceptsInDataCluster = service
                .getConceptsInDataCluster(new WSGetConceptsInDataCluster(new WSDataClusterPK(clusterName)));
        if (conceptsInDataCluster != null) {
            List<String> concepts = conceptsInDataCluster.getStrings();
            conceptCombo.removeAll();
            conceptCombo.add("*");//$NON-NLS-1$
            for (String concept : concepts) {
                conceptCombo.add(concept);
            }
        } else {
            boolean selected = doSelectDataModelForEntityRecords(clusterName);
            if (!selected) {
                return false;
            }
        }

        conceptCombo.select(0);
        searchText.setFocus();
    } catch (ServerException e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(getSite().getShell(), Messages._Error,
                Messages.DataClusterBrowser_dataContainerError);
        return false;
    } catch (WebServiceException e) {
        log.error(e.getMessage(), e);
        if (!Util.handleConnectionException(getSite().getShell(), e, null)) {
            MessageDialog.openError(getSite().getShell(), Messages._Error,
                    Messages.DataClusterBrowser_connectionError);
        }
        return false;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getSite().getShell(), Messages._Error,
                Messages.bind(Messages.DataClusterBrowser_error, e.getLocalizedMessage()));
        return false;
    }

    return true;
}

From source file:org.auscope.portal.server.web.controllers.GridSubmitController.java

/**
 * Create a stageIn directories on Pbstore. If any errors update status.
 * @param the request to save created directories.
 * // ww  w .ja va  2  s .  c  o m
 */
private boolean createGridDir(HttpServletRequest request, String myDir) {
    GridTransferStatus status = new GridTransferStatus();
    Object credential = request.getSession().getAttribute("userCred");
    boolean success = true;
    if (credential == null) {
        status.currentStatusMsg = GridSubmitController.CREDENTIAL_ERROR;
        return false;
    }

    try {
        GridFTPClient gridStore = new GridFTPClient(gridAccess.getRepoHostName(),
                gridAccess.getRepoHostFTPPort());
        gridStore.authenticate((GSSCredential) credential); //authenticating
        gridStore.setDataChannelAuthentication(DataChannelAuthentication.SELF);
        gridStore.setDataChannelProtection(GridFTPSession.PROTECTION_SAFE);
        if (!gridStore.exists(myDir))
            gridStore.makeDir(myDir);

        logger.debug("Created Grid Directory.");
        gridStore.close();

    } catch (ServerException e) {
        logger.error("GridFTP ServerException: " + e.getMessage());
        status.currentStatusMsg = GridSubmitController.GRID_LINK;
        status.jobSubmissionStatus = JobSubmissionStatus.Failed;
        success = false;
    } catch (IOException e) {
        logger.error("GridFTP IOException: " + e.getMessage());
        status.currentStatusMsg = GridSubmitController.GRID_LINK;
        status.jobSubmissionStatus = JobSubmissionStatus.Failed;
        success = false;
    } catch (Exception e) {
        logger.error("GridFTP Exception: " + e.getMessage());
        status.currentStatusMsg = GridSubmitController.GRID_LINK;
        status.jobSubmissionStatus = JobSubmissionStatus.Failed;
        success = false;
    }

    // Save in session for status update request for this job.
    request.getSession().setAttribute("gridStatus", status);
    return success;
}

From source file:org.auscope.portal.server.web.controllers.GridSubmitController.java

/**
 * This method using GridFTP Client returns directory list of stageOut directory 
 * and sub directories./*  w w  w .  j  a v a2  s  .c  o  m*/
 * @param fullDirname
 * @param credential
 * @return
 */
private FileInformation[] getDirectoryListing(String fullDirname, Object credential) {
    GridFTPClient gridStore = null;
    FileInformation[] fileDetails = new FileInformation[0];
    try {
        gridStore = new GridFTPClient(gridAccess.getRepoHostName(), gridAccess.getRepoHostFTPPort());
        gridStore.authenticate((GSSCredential) credential); //authenticating
        gridStore.setDataChannelAuthentication(DataChannelAuthentication.SELF);
        gridStore.setDataChannelProtection(GridFTPSession.PROTECTION_SAFE);
        logger.debug("Change to Grid StageOut dir:" + fullDirname);
        gridStore.changeDir(fullDirname);
        logger.debug("List files in StageOut dir:" + gridStore.getCurrentDir());
        gridStore.setType(GridFTPSession.TYPE_ASCII);
        gridStore.setPassive();
        gridStore.setLocalActive();

        Vector list = gridStore.list("*");

        if (list != null && !(list.isEmpty())) {
            fileDetails = new FileInformation[list.size()];
            for (int i = list.size() - 1; i >= 0; i--) {
                FileInfo fInfo = (FileInfo) list.get(i);
                fileDetails[i] = new FileInformation(fInfo.getName(), fInfo.getSize(), fullDirname,
                        fInfo.isDirectory());
            }
        }
    } catch (ServerException e) {
        logger.error("GridFTP ServerException: " + e.getMessage());
    } catch (IOException e) {
        logger.error("GridFTP IOException: " + e.getMessage());
    } catch (Exception e) {
        logger.error("GridFTP Exception: " + e.getMessage());
    } finally {
        try {
            if (gridStore != null)
                gridStore.close();
        } catch (Exception e) {
            logger.error("GridFTP Exception: " + e.getMessage());
        }
    }
    return fileDetails;
}

From source file:org.auscope.portal.server.web.controllers.JobListController.java

private boolean directoryExist(String fullDirname, Object credential) {
    GridFTPClient gridStore = null;/*w  ww.ja va2 s.co  m*/
    boolean rtnValue = true;
    try {
        gridStore = new GridFTPClient(gridAccess.getRepoHostName(), gridAccess.getRepoHostFTPPort());
        gridStore.authenticate((GSSCredential) credential); //authenticating
        gridStore.setDataChannelAuthentication(DataChannelAuthentication.SELF);
        gridStore.setDataChannelProtection(GridFTPSession.PROTECTION_SAFE);
        logger.debug("Change to Grid StageOut dir:" + fullDirname);
        gridStore.changeDir(fullDirname);

    } catch (ServerException e) {
        logger.error("GridFTP ServerException: " + e.getMessage());
        rtnValue = false;
    } catch (IOException e) {
        logger.error("GridFTP IOException: " + e.getMessage());
        rtnValue = false;
    } catch (Exception e) {
        logger.error("GridFTP Exception: " + e.getMessage());
        rtnValue = false;
    } finally {
        try {
            if (gridStore != null)
                gridStore.close();
        } catch (Exception e) {
            logger.error("GridFTP Exception: " + e.getMessage());
        }
    }
    return rtnValue;
}