Example usage for java.rmi RemoteException getMessage

List of usage examples for java.rmi RemoteException getMessage

Introduction

In this page you can find the example usage for java.rmi RemoteException 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:org.wso2.carbon.admin.service.AdminServiceAuthentication.java

public String login(String userName, String password, String hostName) {

    Boolean loginStatus = null;//  w w w .j  a v  a  2s.c om
    try {
        loginStatus = authenticationAdminStub.login(userName, password, hostName);
    } catch (RemoteException e) {
        log.error("Login failed due to RemoteException" + e.getMessage());
        Assert.fail("Login failed due to RemoteException" + e.getMessage());
    } catch (LoginAuthenticationExceptionException e) {
        log.error("Login failed due to LoginAuthenticationExceptionException" + e.getMessage());
        Assert.fail("Login failed due to LoginAuthenticationExceptionException" + e.getMessage());
    }
    Assert.assertTrue("Login unsuccessful", loginStatus);
    log.info("Login Successful");
    ServiceContext serviceContext = authenticationAdminStub._getServiceClient().getLastOperationContext()
            .getServiceContext();
    String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
    return sessionCookie;
}

From source file:org.wso2.carbon.admin.service.AdminServiceCarbonAppUploader.java

public void uploadCarbonAppArtifact(String sessionCookie, String fileName, DataHandler dh) {
    UploadedFileItem[] carbonAppArray = new UploadedFileItem[1];
    UploadedFileItem carbonApp = new UploadedFileItem();

    new AuthenticateStub().authenticateStub(sessionCookie, carbonAppUploaderStub);
    carbonApp.setFileName(fileName);// w  ww.  ja v  a 2 s.c  o m
    carbonApp.setDataHandler(dh);
    carbonApp.setFileType("jar");

    carbonAppArray[0] = carbonApp;
    try {
        carbonAppUploaderStub.uploadApp(carbonAppArray);
    } catch (RemoteException e) {
        log.error("Remote Exception thrown while uploding car artifact :" + e.getMessage());
        Assert.fail("Remote Exception thrown while uploding car artifact :" + e.getMessage());
    }

}

From source file:org.wso2.carbon.admin.service.AdminServiceWebAppAdmin.java

public void deleteWebAppFile(String sessionCookie, String fileName) {
    new AuthenticateStub().authenticateStub(sessionCookie, webappAdminStub);
    try {//from ww w .java  2  s  .  c  om
        webappAdminStub.deleteStartedWebapps(new String[] { fileName });
    } catch (RemoteException e) {
        log.error("Thrown RemoteException while deleting webapp :" + e.getMessage());
        Assert.fail("Thrown RemoteException while deleting webapp :" + e.getMessage());
    }
}

From source file:org.wso2.carbon.analytics.common.jmx.agent.ui.JmxConnector.java

public String[][] getMBeanAttributes(String objName, String url, String userName, String Password)
        throws RemoteException {

    try {/*from   w  ww.java 2  s  .c o  m*/

        ArrayOfString[] arr = stub.getMBeanAttributeInfo(objName, url, userName, Password);
        int height = arr.length;

        String[][] strArr = new String[height][];

        for (int i = 0; i < height; i++) {
            int width = arr[i].getArray().length;
            strArr[i] = new String[width];
            for (int k = 0; k < width; k++) {
                strArr[i][k] = arr[i].getArray()[k];
            }
        }

        return strArr;

    } catch (RemoteException e) {
        log.error(e);
        throw new RemoteException(e.getMessage());
    } catch (JmxAgentIntrospectionExceptionException e) {
        log.error(e);
        throw new RemoteException(e.getMessage());
    } catch (JmxAgentReflectionExceptionException e) {
        log.error(e);
        throw new RemoteException(e.getMessage());
    } catch (JmxAgentMalformedObjectNameExceptionException e) {
        log.error(e);
        throw new RemoteException(e.getMessage());
    } catch (JmxAgentInstanceNotFoundExceptionException e) {
        log.error(e);
        throw new RemoteException(e.getMessage());
    } catch (JmxAgentIOExceptionException e) {
        log.error(e);
        throw new RemoteException(e.getMessage());
    } catch (NullPointerException e) {
        //if there are no attributes in the mBean
        return null;
    }
}

From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java

public ResponseBean tableExists(String tableName) {
    if (logger.isDebugEnabled()) {
        logger.debug("Invoking tableExists for table: " + tableName);
    }//w w  w  .  j a  va 2 s. c om
    try {
        boolean tableExists = analyticsWebServiceStub.tableExists(tableName);
        if (logger.isDebugEnabled()) {
            logger.debug("Table's Existance : " + tableExists);
        }
        if (!tableExists) {
            return handleResponse(ResponseStatus.NON_EXISTENT, "Table : " + tableName + " does not exist.");
        }
    } catch (RemoteException e) {
        logger.error("Failed to check the existance of the table: " + e.getMessage(), e);
        return handleResponse(ResponseStatus.FAILED,
                "Failed to check the existance of table: " + tableName + ": " + e.getMessage());
    } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) {
        logger.error("Failed to check the existance of the table: " + e.getFaultMessage(), e);
        return handleResponse(ResponseStatus.FAILED,
                "Failed to check the existance of table: " + tableName + ": " + e.getFaultMessage());
    }
    return handleResponse(ResponseStatus.SUCCESS, "Table : " + tableName + " exists.");
}

From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java

public ResponseBean addStreamDefinition(String streamDefAsString) {
    if (logger.isDebugEnabled()) {
        logger.debug("invoking addStreamDefinition");
    }//from www.j ava 2 s  .  c o  m
    try {
        if (streamDefAsString != null && !streamDefAsString.isEmpty()) {
            StreamDefinitionBean streamDefinitionBean = gson.fromJson(streamDefAsString,
                    StreamDefinitionBean.class);
            String streamId = analyticsWebServiceStub
                    .addStreamDefinition(Utils.getStreamDefinition(streamDefinitionBean));
            return handleResponse(ResponseStatus.CREATED, streamId);
        } else {
            return handleResponse(ResponseStatus.NON_EXISTENT, "StreamDefinition is not given");
        }
    } catch (RemoteException e) {
        logger.error("Failed to add the stream definition: " + e.getMessage(), e);
        return handleResponse(ResponseStatus.FAILED,
                "Failed to add the stream definition: " + ": " + e.getMessage());
    } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) {
        logger.error("Failed to add the stream definition: " + e.getFaultMessage(), e);
        return handleResponse(ResponseStatus.FAILED,
                "Failed to add the stream definition: " + ": " + e.getFaultMessage());
    } catch (AnalyticsWebServiceMalformedStreamDefinitionExceptionException e) {
        logger.error("Failed to add the stream definition: " + e.getFaultMessage(), e);
        return handleResponse(ResponseStatus.FAILED,
                "Failed to add the stream definition: " + ": " + e.getFaultMessage());
    }
}

From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java

public ResponseBean getStreamDefinition(String requestAsString) {
    try {/*  w  ww .j a  va2 s .c o  m*/
        if (requestAsString != null && !requestAsString.isEmpty()) {
            StreamDefinitionQueryBean queryBean = gson.fromJson(requestAsString,
                    StreamDefinitionQueryBean.class);
            if (logger.isDebugEnabled()) {
                logger.debug("invoking getStreamDefinition for name: " + queryBean.getName() + " version: "
                        + queryBean.getVersion());
            }
            org.wso2.carbon.analytics.webservice.stub.beans.StreamDefinitionBean streamDefinitionBean = analyticsWebServiceStub
                    .getStreamDefinition(queryBean.getName(), queryBean.getVersion());
            StreamDefinitionBean streamDefinition = Utils.getStreamDefinitionBean(streamDefinitionBean);
            return handleResponse(ResponseStatus.SUCCESS, gson.toJson(streamDefinition));
        } else {
            return handleResponse(ResponseStatus.NON_EXISTENT, "Name of the Stream is not given");
        }
    } catch (RemoteException e) {
        logger.error("Failed to get the stream definition: " + e.getMessage(), e);
        return handleResponse(ResponseStatus.FAILED,
                "Failed to get the stream definition: " + ": " + e.getMessage());
    } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) {
        logger.error("Failed to get the stream definition: " + e.getFaultMessage(), e);
        return handleResponse(ResponseStatus.FAILED,
                "Failed to get the stream definition: " + ": " + e.getFaultMessage());
    }
}

From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java

public ResponseBean publishEvent(String eventAsString) {
    if (logger.isDebugEnabled()) {
        logger.debug("invoking publishEvent");
    }/*from w ww  .  j a  va2 s  . c o m*/
    try {
        if (eventAsString != null && !eventAsString.isEmpty()) {
            EventBean eventBean = gson.fromJson(eventAsString, EventBean.class);
            if (logger.isDebugEnabled()) {
                logger.debug("publishing event: stream : " + eventBean.getStreamName() + ", version: "
                        + eventBean.getStreamVersion());
            }
            analyticsWebServiceStub.publishEvent(Utils.getStreamEvent(eventBean));
            return handleResponse(ResponseStatus.SUCCESS, "Event published successfully");

        } else {
            return handleResponse(ResponseStatus.NON_EXISTENT, "Stream event is not provided");
        }
    } catch (RemoteException e) {
        logger.error("Failed to publish event: " + e.getMessage(), e);
        return handleResponse(ResponseStatus.FAILED, "Failed to publish event: " + ": " + e.getMessage());
    } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) {
        logger.error("Failed to publish event: " + e.getFaultMessage(), e);
        return handleResponse(ResponseStatus.FAILED, "Failed to publish event: " + ": " + e.getFaultMessage());
    }
}

From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java

public ResponseBean getTableList() {
    String[] tableList;//w w w  .java  2s. c om
    try {
        tableList = analyticsWebServiceStub.listTables();
    } catch (RemoteException e) {
        logger.error("Unable to get table list:" + e.getMessage(), e);
        return handleResponse(ResponseStatus.FAILED, "Unable to get table list: " + e.getMessage());
    } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) {
        logger.error("Unable to get table list:" + e.getFaultMessage(), e);
        return handleResponse(ResponseStatus.FAILED, "Unable to get table list: " + e.getFaultMessage());
    }
    if (tableList == null) {
        if (logger.isDebugEnabled()) {
            logger.debug("Received an empty table name list!");
        }
        tableList = new String[0];
    }
    return handleResponse(ResponseStatus.SUCCESS, gson.toJson(tableList));
}

From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java

public ResponseBean getRecordStoreList() {
    String[] recordStoreList;/*ww  w.  j a  v  a2s  .  co m*/
    try {
        recordStoreList = analyticsWebServiceStub.listRecordStoreNames();
    } catch (RemoteException e) {
        logger.error("Unable to get recordStore list:" + e.getMessage(), e);
        return handleResponse(ResponseStatus.FAILED, "Unable to get recordStore list: " + e.getMessage());
    } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) {
        logger.error("Unable to get recordStore list:" + e.getFaultMessage(), e);
        return handleResponse(ResponseStatus.FAILED, "Unable to get recordStore list: " + e.getFaultMessage());
    }
    if (recordStoreList == null) {
        if (logger.isDebugEnabled()) {
            logger.debug("Received an empty recordStore name list!");
        }
        recordStoreList = new String[0];
    }
    return handleResponse(ResponseStatus.SUCCESS, gson.toJson(recordStoreList));
}