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.appserver.sample.flickr.client.FlickrServiceClient.java

public String flickrPhotosRecentlyUpdated(String minDate, ExtrasBean extrasBean, String page, String perPage,
        String sharedSecret, String token, String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosRecentlyUpdated photosRecentlyUpdated = new PhotosRecentlyUpdated();
    photosRecentlyUpdated.setApi_key(key);
    photosRecentlyUpdated.setAuth_token(token);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token;
    String extras = processExtras(extrasBean);
    if (!"".equals(extras.trim())) {
        photosRecentlyUpdated.setExtras(extras);
        sig = sig + "extras" + extras;
    }/*w w  w  . j a  v a 2  s  .c  o  m*/
    sig = sig + "formatrest";
    sig = sig + "method" + "flickr.photos.recentlyUpdated";
    if (minDate != null && !"".equals(minDate.trim())) {
        UnixTimeStamp date = new UnixTimeStamp();
        date.setUnixTimeStamp(minDate);
        photosRecentlyUpdated.setMin_date(date);
        sig = sig + "min_date" + minDate;
    }
    if (page != null && !"".equals(page.trim())) {
        photosRecentlyUpdated.setPage(new BigInteger(page));
        sig = sig + "page" + page;
    }
    if (perPage != null && !"".equals(perPage.trim())) {
        photosRecentlyUpdated.setPer_page(new BigInteger(perPage));
        sig = sig + "per_page" + perPage;
    }
    String output = "";
    try {
        photosRecentlyUpdated.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrPhotosRecentlyUpdated(photosRecentlyUpdated);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            OMElement[] elements = response.getExtraElement();
            for (int i = 0; i < elements.length; i++) {
                OMElement photos = elements[i];
                output = "List of your photos that have been recently created or which have been recently modified.\n\n";
                output = output + "Page : " + photos.getAttribute(new QName("page")).getAttributeValue()
                        + "\nPages : " + photos.getAttribute(new QName("pages")).getAttributeValue() + "\n";
                output = output + "Per Page : " + photos.getAttribute(new QName("perpage")).getAttributeValue()
                        + "\nTotal : " + photos.getAttribute(new QName("total")).getAttributeValue() + "\n";
                Iterator iterator = photos.getChildElements();
                while (iterator.hasNext()) {
                    OMElement photo = (OMElement) iterator.next();
                    output = output + "\nPhoto\nPhoto ID : "
                            + photo.getAttribute(new QName("id")).getAttributeValue() + "\nOwner ID : "
                            + photo.getAttribute(new QName("owner")).getAttributeValue() + "\nSecret : "
                            + photo.getAttribute(new QName("secret")).getAttributeValue() + "\n";
                    output = output + "Title : " + photo.getAttribute(new QName("title")).getAttributeValue()
                            + "\nIs Public : " + photo.getAttribute(new QName("ispublic")).getAttributeValue()
                            + "\nIs Friend : " + photo.getAttribute(new QName("isfriend")).getAttributeValue()
                            + "\n";
                    output = output + "Is Family : "
                            + photo.getAttribute(new QName("isfamily")).getAttributeValue()
                            + "\nLast Updated : "
                            + photo.getAttribute(new QName("lastupdate")).getAttributeValue() + "\n";

                }
            }
        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}

From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceClient.java

public String flickrPhotosRemoveTag(String tagID, String sharedSecret, String token, String key, String host,
        String port) {//from  w  w w  . j  av a  2s .c o  m
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosRemoveTag photosRemoveTag = new PhotosRemoveTag();
    photosRemoveTag.setApi_key(key);
    photosRemoveTag.setTag_id(tagID);
    String output = "";
    try {
        Rsp response = flickrServiceStub.flickrPhotosRemoveTag(photosRemoveTag);
        StatType statType = response.getStat();
        Token retToken = statType.getValue();
        if (retToken.equals(StatType._ok)) {
            output = "Removed tag succesfully";
        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}

From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceClient.java

public String flickrPhotosSearch(String userID, String tags, AnyOrAll tagMode, String text, String minUpDate,
        String maxUpDate, String minTakDate, String maxTakDate, String license, SortOrder sort, String privacy,
        String accuracy, String machineTags, AnyOrAll machineTagsMode, String grpID, ExtrasBean extrasBean,
        String page, String perPage, String sharedSecret, String token, String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosSearch photosSearch = new PhotosSearch();
    photosSearch.setApi_key(key);/*from  w  ww  .j a va  2  s  . c o  m*/
    String extras = processExtras(extrasBean);
    if (!"".equals(extras.trim())) {
        photosSearch.setExtras(extras);
    }
    if (minTakDate != null && !"".equals(minTakDate.trim())) {
        UnixTimeStamp date = new UnixTimeStamp();
        date.setUnixTimeStamp(minTakDate);
        photosSearch.setMin_taken_date(date);
    }
    if (minUpDate != null && !"".equals(minUpDate.trim())) {
        UnixTimeStamp date = new UnixTimeStamp();
        date.setUnixTimeStamp(minUpDate);
        photosSearch.setMin_upload_date(date);
    }
    if (maxTakDate != null && !"".equals(maxTakDate.trim())) {
        UnixTimeStamp date = new UnixTimeStamp();
        date.setUnixTimeStamp(maxTakDate);
        photosSearch.setMax_taken_date(date);
    }
    if (maxUpDate != null && !"".equals(maxUpDate.trim())) {
        UnixTimeStamp date = new UnixTimeStamp();
        date.setUnixTimeStamp(maxUpDate);
        photosSearch.setMax_upload_date(date);
    }
    if (page != null && !"".equals(page.trim())) {
        photosSearch.setPage(new BigInteger(page));
    }
    if (perPage != null && !"".equals(perPage.trim())) {
        photosSearch.setPer_page(new BigInteger(perPage));
    }
    if (privacy != null && !"".equals(privacy.trim())) {
        photosSearch.setPrivacy_filter(new BigInteger(privacy));
    }
    if (userID != null && !"".equals(userID.trim())) {
        photosSearch.setUser_id(userID);
    }
    if (tags != null && !"".equals(tags.trim())) {
        photosSearch.setTags(tags);
    }
    if (tagMode != null) {
        photosSearch.setTag_mode(tagMode);
    }
    if (text != null && !"".equals(text.trim())) {
        photosSearch.setText(text);
    }
    if (license != null && !"".equals(license.trim())) {
        photosSearch.setLicense(license);
    }
    if (sort != null) {
        photosSearch.setSort(sort);
    }
    if (accuracy != null && !"".equals(accuracy.trim())) {
        photosSearch.setAccuracy(new BigInteger(accuracy));
    }
    if (machineTags != null && !"".equals(machineTags.trim())) {
        photosSearch.setMachine_tags(machineTags);
    }
    if (machineTagsMode != null) {
        photosSearch.setMachine_tag_mode(machineTagsMode);
    }
    if (grpID != null && !"".equals(grpID.trim())) {
        photosSearch.setGroup_id(grpID);
    }
    String output = "";
    try {
        Rsp response = flickrServiceStub.flickrPhotosSearch(photosSearch);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            OMElement[] elements = response.getExtraElement();
            for (int i = 0; i < elements.length; i++) {
                OMElement photos = elements[i];
                output = "Search Results.\n\n" + "Page : "
                        + photos.getAttribute(new QName("page")).getAttributeValue() + "\nPages : "
                        + photos.getAttribute(new QName("pages")).getAttributeValue() + "\n" + "Per Page : "
                        + photos.getAttribute(new QName("perpage")).getAttributeValue() + "\nTotal : "
                        + photos.getAttribute(new QName("total")).getAttributeValue() + "\n";
                Iterator iterator = photos.getChildElements();
                while (iterator.hasNext()) {
                    OMElement photo = (OMElement) iterator.next();
                    output = output + "\nPhoto\nPhoto ID : "
                            + photo.getAttribute(new QName("id")).getAttributeValue() + "\nOwner ID : "
                            + photo.getAttribute(new QName("owner")).getAttributeValue() + "\nSecret : "
                            + photo.getAttribute(new QName("secret")).getAttributeValue() + "\n" + "Title : "
                            + photo.getAttribute(new QName("title")).getAttributeValue() + "\nIs Public : "
                            + photo.getAttribute(new QName("ispublic")).getAttributeValue() + "\nIs Friend : "
                            + photo.getAttribute(new QName("isfriend")).getAttributeValue() + "\n"
                            + "Is Family : " + photo.getAttribute(new QName("isfamily")).getAttributeValue()
                            + "\n";
                }
            }
        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}

From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceClient.java

public String flickrPhotosSetDates(String photoID, String datePosted, String dateTaken, String granularity,
        String sharedSecret, String token, String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosSetDates photosSetDates = new PhotosSetDates();
    photosSetDates.setApi_key(key);//from ww w  . ja  v a  2 s  .  c om
    photosSetDates.setAuth_token(token);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token;
    if (datePosted != null && !"".equals(datePosted.trim())) {
        photosSetDates.setDate_posted(datePosted);
        sig = sig + "date_posted" + datePosted;
    }
    if (dateTaken != null && !"".equals(dateTaken.trim())) {
        photosSetDates.setDate_taken(dateTaken);
        sig = sig + "date_taken" + dateTaken;
    }
    if (granularity != null && !"".equals(granularity.trim())) {
        photosSetDates.setDate_taken_granularity(granularity);
        sig = sig + "date_taken_granularity" + granularity;
    }
    photosSetDates.setPhoto_id(photoID);
    String output = "";
    try {
        Rsp response = flickrServiceStub.flickrPhotosSetDates(photosSetDates);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            output = "Set Dates succesfully.\n\n";

        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}

From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceClient.java

public String flickrPhotosSetMeta(String photoID, String title, String description, String sharedSecret,
        String token, String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosSetMeta photosSetMeta = new PhotosSetMeta();
    photosSetMeta.setApi_key(key);//from   ww  w .  j  a  v  a  2s  .  c o  m
    photosSetMeta.setAuth_token(token);
    photosSetMeta.setTitle(title);
    photosSetMeta.setDescription(description);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token + "description" + description
            + "formatrest" + "method" + "flickr.photos.setMeta" + "photo_id" + photoID + "title" + title;
    photosSetMeta.setPhoto_id(photoID);
    String output = "";
    try {
        photosSetMeta.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrPhotosSetMeta(photosSetMeta);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            output = "Set Meta Data succesfully.\n\n";

        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}

From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceClient.java

public String flickrPhotosSetPerms(String photoID, boolean isPublic, boolean isFriend, boolean isFamily,
        String permComment, String permMetaData, String sharedSecret, String token, String key, String host,
        String port) {//ww w  . ja  v  a 2s .c  o  m
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosSetPerms photosSetPerms = new PhotosSetPerms();
    photosSetPerms.setApi_key(key);
    photosSetPerms.setAuth_token(token);
    photosSetPerms.setPerm_comment(new BigInteger(permComment));
    photosSetPerms.setPerm_addmeta(new BigInteger(permMetaData));
    String sig = sharedSecret + "api_key" + key + "auth_token" + token + "formatrest" + "method"
            + "flickr.photos.setPerms";

    if (isFamily) {
        photosSetPerms.setIs_family(new BigInteger("1"));
        sig = sig + "is_family1";
    } else {
        photosSetPerms.setIs_family(new BigInteger("0"));
        sig = sig + "is_family0";
    }
    if (isFriend) {
        photosSetPerms.setIs_friend(new BigInteger("1"));
        sig = sig + "is_friend1";
    } else {
        photosSetPerms.setIs_friend(new BigInteger("0"));
        sig = sig + "is_friend0";
    }
    if (isPublic) {
        photosSetPerms.setIs_public(new BigInteger("1"));
        sig = sig + "is_public1";
    } else {
        photosSetPerms.setIs_public(new BigInteger("0"));
        sig = sig + "is_public0";
    }
    sig = sig + "perm_addmeta" + permMetaData + "perm_comment" + permComment + "photo_id" + photoID;
    photosSetPerms.setPhoto_id(photoID);
    String output = "";
    try {
        photosSetPerms.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrPhotosSetPerms(photosSetPerms);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            output = "Set Permissions succesfully.\n\n";

        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}

From source file:org.wso2.appserver.sample.flickr.client.FlickrServiceClient.java

public String flickrPhotosSetTags(String photoID, String tags, String sharedSecret, String token, String key,
        String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosSetTags photosSetTags = new PhotosSetTags();
    photosSetTags.setApi_key(key);/*from   w  w  w. j  a  v a2  s.  c  o m*/
    photosSetTags.setAuth_token(token);
    photosSetTags.setTags(tags);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token + "formatrest" + "method"
            + "flickr.photos.setTags" + "photo_id" + photoID + "tags" + tags;
    photosSetTags.setPhoto_id(photoID);
    String output = "";
    try {
        photosSetTags.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrPhotosSetTags(photosSetTags);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            output = "Set Tags succesfully.\n\n";

        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}

From source file:org.wso2.bam.integration.tests.archive.CassandraDataArchiveTestCase.java

private void runJDBCHandlerTest() {
    String[] queries = getHiveQueries("ArchiveCassandraDataTest");
    try {/*  w w w . j  a v  a2  s  . c  o m*/
        hiveStub.executeHiveScript(null, queries[0].trim());
        HiveExecutionServiceStub.QueryResult[] results = hiveStub.executeHiveScript(null, queries[1].trim());

        assertTrue(null != results && results.length != 0, "No results are returned from jdbc handler test");
        HiveExecutionServiceStub.QueryResultRow[] rows = results[0].getResultRows();
        assertTrue(null != rows && rows.length != 0, "No results are returned from jdbc handler test");
        String[] vals = rows[0].getColumnValues();
        assertTrue(null != vals && vals.length != 0, "No results are returned from jdbc handler test");

        boolean resultsAreCorrect = false;
        if (vals[2].equals("800") && vals[3].equals("0") && vals[4].equals("2.25") && vals[5].equals("4.7")
                && vals[6].equals("0.2")) {
            resultsAreCorrect = true;
        }

        assertTrue(resultsAreCorrect, "Results are different from expected one: " + vals[2] + ":" + vals[3]
                + ":" + vals[4] + ":" + vals[5] + ":" + vals[6]);

    } catch (RemoteException e) {
        fail("Failed while executing hive script ArchiveCassandraDataTest " + e.getMessage());
    } catch (HiveExecutionServiceHiveExecutionException e) {
        fail("Failed while executing hive script ArchiveCassandraDataTest " + e.getMessage());
    }
}

From source file:org.wso2.bam.integration.tests.hive.BAMJDBCHandlerTestCase.java

private void runJDBCHandlerTest() {
    String[] queries = getHiveQueries("HiveJDBCHandlerPrimaryKeyTest");
    try {/*from   w  ww  .  j ava  2s .co m*/
        hiveStub.executeHiveScript(null, queries[0].trim());
        hiveStub.executeHiveScript(null, queries[1].trim());
        hiveStub.executeHiveScript(null, queries[2].trim());
        hiveStub.executeHiveScript(null, queries[3].trim());
        HiveExecutionServiceStub.QueryResult[] results = hiveStub.executeHiveScript(null, queries[4].trim());

        assertTrue(null != results && results.length != 0, "No results are returned from jdbc handler test");
        HiveExecutionServiceStub.QueryResultRow[] rows = results[0].getResultRows();
        assertTrue(null != rows && rows.length != 0, "No results are returned from jdbc handler test");
        String[] vals = rows[0].getColumnValues();
        assertTrue(null != vals && vals.length != 0, "No results are returned from jdbc handler test");

        boolean resultsAreCorrect = false;
        if (Integer.parseInt(vals[2]) == ((event2RequestCount + event4RequestCount) * NUMBER_OF_EVENTS)
                && Integer.parseInt(vals[3]) == ((faultCount2 + faultCount4) * NUMBER_OF_EVENTS)
                && Double.parseDouble(vals[4]) == ((avg_response_time2 * NUMBER_OF_EVENTS
                        + avg_response_time4 * NUMBER_OF_EVENTS) / (2 * NUMBER_OF_EVENTS))
                && Float.parseFloat(vals[5]) == responseTime4
                && Float.parseFloat(vals[6]) == minResponseTime4) {
            resultsAreCorrect = true;
        }

        assertTrue(resultsAreCorrect, "Results are different from expected one: " + vals[2] + ":" + vals[3]
                + ":" + vals[4] + ":" + vals[5] + ":" + vals[6]);

        hiveStub.executeHiveScript(null, queries[5].trim());
        hiveStub.executeHiveScript(null, queries[6].trim());
        hiveStub.executeHiveScript(null, queries[7].trim());

        HiveExecutionServiceStub.QueryResult[] newResults = hiveStub.executeHiveScript(null, queries[8].trim());
        assertTrue(null != newResults && newResults.length != 0,
                "No results are returned from jdbc handler test");
        HiveExecutionServiceStub.QueryResultRow[] newRow = newResults[0].getResultRows();
        assertTrue(null != newRow && newRow.length != 0, "No results are returned from jdbc handler test");
        String[] newValue = newRow[0].getColumnValues();
        assertTrue(null != newValue && newValue.length != 0, "No results are returned from jdbc handler test");

        boolean newResultsAreCorrect = false;
        if (Integer.parseInt(newValue[2]) == event4RequestCount * NUMBER_OF_EVENTS
                && Integer.parseInt(newValue[3]) == faultCount4 * NUMBER_OF_EVENTS
                && Double.parseDouble(newValue[4]) == (avg_response_time4 * NUMBER_OF_EVENTS) / NUMBER_OF_EVENTS
                && Float.parseFloat(newValue[5]) == responseTime4
                && Float.parseFloat(newValue[6]) == minResponseTime4) {
            newResultsAreCorrect = true;
        }
        assertTrue(newResultsAreCorrect, "Results are different from expected one: " + newValue[2] + ":"
                + newValue[3] + ":" + newValue[4] + ":" + newValue[5] + ":" + newValue[6]);

    } catch (RemoteException e) {
        fail("Failed while executing hive script HiveJDBCHandlerPrimaryKeyTest " + e.getMessage());
    } catch (HiveExecutionServiceHiveExecutionException e) {
        fail("Failed while executing hive script HiveJDBCHandlerPrimaryKeyTest " + e.getMessage());
    }
}

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

public void uploadAARFile(String sessionCookie, String fileName, String filePath, String serviceHierarchy) {
    AARServiceData aarServiceData;/*from   w ww  .j  av a2 s. co  m*/

    new AuthenticateStub().authenticateStub(sessionCookie, serviceUploaderStub);

    aarServiceData = new AARServiceData();
    aarServiceData.setFileName(fileName);
    aarServiceData.setDataHandler(createDataHandler(filePath));
    aarServiceData.setServiceHierarchy(serviceHierarchy);

    try {
        serviceUploaderStub.uploadService(new AARServiceData[] { aarServiceData });
    } catch (RemoteException e) {
        log.error("AAR Upload failed with RemoteException : " + e.getMessage());
        Assert.fail("AAR Upload failed with RemoteException : " + e.getMessage());
    } catch (ExceptionException e) {
        log.error("AAR Upload failed due to : " + e.getMessage());
        Assert.fail("AAR Upload failed due to  : " + e.getMessage());
    }
    log.info("Service Uploaded");
}