List of usage examples for java.rmi RemoteException getMessage
public String getMessage()
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean getRecordStoreByTable(String tableName) { String recordStore;/*from www . j a va2 s .c o m*/ try { recordStore = analyticsWebServiceStub.getRecordStoreNameByTable(tableName); } catch (RemoteException e) { logger.error("Unable to get recordStore for table '" + tableName + "': " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Unable to get recordStore for table '" + tableName + "': " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("Unable to get recordStore for table '" + tableName + "': " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Unable to get recordStore for table '" + tableName + "': " + e.getFaultMessage()); } if (recordStore == null) { if (logger.isDebugEnabled()) { logger.debug("Received an empty recordStore name list!"); } recordStore = ""; } return handleResponse(ResponseStatus.SUCCESS, gson.toJson(recordStore)); }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean getRecordCount(String tableName) { if (logger.isDebugEnabled()) { logger.debug("Invoking getRecordCount for tableName: " + tableName); }//from w ww . ja v a 2 s .c om try { long recordCount = analyticsWebServiceStub.getRecordCount(tableName, AXIS2_MIN, Long.MAX_VALUE); if (logger.isDebugEnabled()) { logger.debug("RecordCount for tableName: " + tableName + " is " + recordCount); } return handleResponse(ResponseStatus.SUCCESS, (new Long(recordCount)).toString()); } catch (RemoteException e) { logger.error("Failed to get record count for table: " + tableName + ": " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get record count for table: " + tableName + ": " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("Failed to get record count for table: " + tableName + ": " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get record count for table: " + tableName + ": " + e.getFaultMessage()); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean getRecordsByRange(String tableName, String timeFrom, String timeTo, String recordsFrom, String count, String columns) { if (logger.isDebugEnabled()) { logger.debug("Invoking getRecordByRange for tableName: " + tableName); }/*from w w w.j av a 2 s. c o m*/ try { long from = validateNumericValue("timeFrom", timeFrom); long to = validateNumericValue("timeTo", timeTo); int start = validateNumericValue("start", recordsFrom).intValue(); int recordCount = validateNumericValue("count", count).intValue(); RecordBean[] recordBeans; String[] columnList = null; if (columns != null) { Type columnType = new TypeToken<String[]>() { }.getType(); columnList = gson.fromJson(columns, columnType); } recordBeans = analyticsWebServiceStub.getByRange(tableName, 1, columnList, from, to, start, recordCount); List<Record> records = Utils.getRecordBeans(recordBeans); return handleResponse(ResponseStatus.SUCCESS, gson.toJson(records)); } catch (RemoteException e) { logger.error("failed to get records from table: '" + tableName + "', " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: '" + tableName + "', " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("failed to get records from table: '" + tableName + "', " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: '" + tableName + "', " + e.getFaultMessage()); } catch (JSServiceException e) { logger.error("failed to get records from table: '" + tableName + "', " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: '" + tableName + "', " + e.getMessage()); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean getWithKeyValues(String tableName, String valuesBatch) { if (logger.isDebugEnabled()) { logger.debug("Invoking getRecordByRange for tableName: " + tableName); }/*w ww . j av a 2s . c om*/ try { if (valuesBatch != null) { ColumnKeyValueBean columnKeyValueBean = gson.fromJson(valuesBatch, ColumnKeyValueBean.class); List<Map<String, Object>> valueBatchList = columnKeyValueBean.getValueBatches(); if (valueBatchList != null && !valueBatchList.isEmpty()) { RecordBean[] recordBeans; String[] columns = columnKeyValueBean.getColumns(); ValuesBatchBean[] valuesBatchBeans = Utils.getValuesBatch(valueBatchList); recordBeans = analyticsWebServiceStub.getWithKeyValues(tableName, 1, columns, valuesBatchBeans); List<Record> records = Utils.getRecordBeans(recordBeans); return handleResponse(ResponseStatus.SUCCESS, gson.toJson(records)); } else { throw new JSServiceException("Values batch is null or empty"); } } else { throw new JSServiceException("Values batch is not provided"); } } catch (RemoteException e) { logger.error("failed to get records from table: '" + tableName + "', " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: '" + tableName + "', " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("failed to get records from table: '" + tableName + "', " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: '" + tableName + "', " + e.getFaultMessage()); } catch (JSServiceException e) { logger.error("failed to get records from table: '" + tableName + "', " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: '" + tableName + "', " + e.getMessage()); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean getRecordsByIds(String tableName, String idsAsString) { if (idsAsString != null && !idsAsString.isEmpty()) { try {//from ww w . j a va 2s. com Type idsType = new TypeToken<List<String>>() { }.getType(); List<String> ids = gson.fromJson(idsAsString, idsType); String[] idArray = ids.toArray(new String[ids.size()]); if (logger.isDebugEnabled()) { logger.debug("Invoking getRecordsByIds for tableName: " + tableName); } RecordBean[] recordBeans = analyticsWebServiceStub.getById(tableName, 1, null, idArray); List<Record> records = Utils.getRecordBeans(recordBeans); return handleResponse(ResponseStatus.SUCCESS, gson.toJson(records)); } catch (RemoteException e) { logger.error("failed to get records from table: " + tableName + " : " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: " + tableName + ": " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("failed to get records from table: " + tableName + " : " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to get records from table: " + tableName + ": " + e.getFaultMessage()); } } else { return handleResponse(ResponseStatus.FAILED, "Id list is empty"); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean clearIndexData(String tableName) { if (logger.isDebugEnabled()) { logger.debug("Invoking clearIndexData for tableName : " + tableName); }/* w w w . ja v a2s . c o m*/ try { analyticsWebServiceStub.clearIndices(tableName); return handleResponse(ResponseStatus.SUCCESS, "Successfully cleared indices in table: " + tableName); } catch (RemoteException e) { logger.error("Failed to clear indices for table: " + tableName + ": " + e.getMessage()); return handleResponse(ResponseStatus.FAILED, "Failed to clear indices for table: " + tableName + ": " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("Failed to clear indices for table: " + tableName + ": " + e.getFaultMessage()); return handleResponse(ResponseStatus.FAILED, "Failed to clear indices for table: " + tableName + ": " + e.getFaultMessage()); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean search(String tableName, String queryAsString) { if (logger.isDebugEnabled()) { logger.debug("Invoking search for tableName : " + tableName); }// ww w.j a v a 2 s . co m if (queryAsString != null && !queryAsString.isEmpty()) { try { QueryBean queryBean = gson.fromJson(queryAsString, QueryBean.class); RecordBean[] searchResults = analyticsWebServiceStub.search(tableName, queryBean.getQuery(), queryBean.getStart(), queryBean.getCount()); List<Record> records = Utils.getRecordBeans(searchResults); if (logger.isDebugEnabled()) { for (Record record : records) { logger.debug( "Search Result -- Record Id: " + record.getId() + " values :" + record.toString()); } } return handleResponse(ResponseStatus.SUCCESS, gson.toJson(records)); } catch (RemoteException e) { logger.error("Failed to perform search on table: " + tableName + " : " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to perform search on table: " + tableName + ": " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("Failed to perform search on table: " + tableName + " : " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to perform search on table: " + tableName + ": " + e.getFaultMessage()); } } else { return handleResponse(ResponseStatus.FAILED, "Search parameters are not provided"); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean searchWithAggregates(String tableName, String requestAsString) { if (logger.isDebugEnabled()) { logger.debug("Invoking search with aggregate for tableName : " + tableName); }/*from ww w .j a va 2 s . c o m*/ if (requestAsString != null && !requestAsString.isEmpty()) { try { AggregateRequest aggregateRequest = gson.fromJson(requestAsString, AggregateRequest.class); AnalyticsAggregateRequest request = Utils.getAggregateRequest(aggregateRequest); RecordBean[] searchResults = analyticsWebServiceStub.searchWithAggregates(request); List<Record> records = Utils.getRecordBeans(searchResults); if (logger.isDebugEnabled()) { for (Record record : records) { logger.debug( "Search Result -- Record Id: " + record.getId() + " values :" + record.toString()); } } return handleResponse(ResponseStatus.SUCCESS, gson.toJson(records)); } catch (RemoteException e) { logger.error( "Failed to perform search with aggregate on table: " + tableName + " : " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to perform search with aggregate on table: " + tableName + ": " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("Failed to perform search with aggregate on table: " + tableName + " : " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to perform search with aggregate on table: " + tableName + ": " + e.getFaultMessage()); } } else { return handleResponse(ResponseStatus.FAILED, "Search parameters are not provided"); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean searchCount(String tableName, String queryAsString) { if (logger.isDebugEnabled()) { logger.debug("Invoking search count for tableName : " + tableName); }/*from w ww . j a va 2 s .c o m*/ if (queryAsString != null && !queryAsString.isEmpty()) { try { QueryBean queryBean = gson.fromJson(queryAsString, QueryBean.class); int result = analyticsWebServiceStub.searchCount(tableName, queryBean.getQuery()); if (logger.isDebugEnabled()) { logger.debug("Search count : " + result); } return handleResponse(ResponseStatus.SUCCESS, gson.toJson(result)); } catch (RemoteException e) { logger.error("Failed to get the record count for table: " + tableName + " : " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, " Failed to get the record count for table: " + tableName + ": " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("Failed to get the record count for table: " + tableName + " : " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, " Failed to get the record count for table: " + tableName + ": " + e.getFaultMessage()); } } else { return handleResponse(ResponseStatus.FAILED, " Search parameters not provided"); } }
From source file:org.wso2.carbon.analytics.jsservice.AnalyticsWebServiceConnector.java
public ResponseBean waitForIndexing(long seconds) { if (logger.isDebugEnabled()) { logger.debug("Invoking waiting for indexing - timeout : " + seconds + " seconds"); }/*from www .j a va 2 s . c o m*/ try { analyticsWebServiceStub.waitForIndexing(seconds * Constants.MILLISECONDSPERSECOND); return handleResponse(ResponseStatus.SUCCESS, "Indexing Completed successfully"); } catch (RemoteException e) { logger.error("Failed to wait till indexing finishes: " + e.getMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to wait till indexing finishes: " + e.getMessage()); } catch (AnalyticsWebServiceAnalyticsWebServiceExceptionException e) { logger.error("Failed to wait till indexing finishes: " + e.getFaultMessage(), e); return handleResponse(ResponseStatus.FAILED, "Failed to wait till indexing finishes: " + e.getFaultMessage()); } }