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 flickrGroupsPoolsAdd(String photoID, String groupID, String sharedSecret, String token,
        String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token + "formatrest" + "group_id" + groupID
            + "method" + "flickr.groups.browse" + "photo_id" + photoID;
    GroupsPoolsAdd groupsPoolsAdd = new GroupsPoolsAdd();
    groupsPoolsAdd.setApi_key(key);/* w  w  w  .j  av  a 2  s  . com*/
    groupsPoolsAdd.setAuth_token(token);
    groupsPoolsAdd.setGroup_id(groupID);
    groupsPoolsAdd.setPhoto_id(photoID);
    String output = "";
    try {
        groupsPoolsAdd.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrGroupsPoolsAdd(groupsPoolsAdd);
        StatType statType = response.getStat();
        Token retToken = statType.getValue();
        if (retToken.equals(StatType._ok)) {
            output = output + "Photo added to group's pool 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 flickrGroupsPoolsGetContext(String photoID, String groupID, String sharedSecret, String token,
        String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    GroupsPoolsGetContext groupsPoolsGetContext = new GroupsPoolsGetContext();
    groupsPoolsGetContext.setApi_key(key);
    groupsPoolsGetContext.setGroup_id(groupID);
    groupsPoolsGetContext.setPhoto_id(photoID);
    String output = "";
    try {//from   w w w  .  j av a  2s  .  c om
        Rsp response = flickrServiceStub.flickrGroupsPoolsGetContext(groupsPoolsGetContext);
        StatType statType = response.getStat();
        Token retToken = statType.getValue();
        if (retToken.equals(StatType._ok)) {
            OMElement[] elements = response.getExtraElement();
            output = "Next and previous photos for a photo in a group pool\n\n";
            OMElement prevphoto = elements[0];
            output = output + "Prevoius photo";
            output = output + "Photo ID : " + prevphoto.getAttribute(new QName("id")).getAttributeValue()
                    + "\nPhoto secret : " + prevphoto.getAttribute(new QName("secret")).getAttributeValue()
                    + "\n";
            output = output + "Photo Title : " + prevphoto.getAttribute(new QName("title")).getAttributeValue()
                    + "\nPhoto URL : " + prevphoto.getAttribute(new QName("url")).getAttributeValue() + "\n\n";
            output = output + "Next photo";
            OMElement nextPhoto = elements[1];
            output = output + "Photo ID : " + nextPhoto.getAttribute(new QName("id")).getAttributeValue()
                    + "\nPhoto secret : " + nextPhoto.getAttribute(new QName("secret")).getAttributeValue()
                    + "\n";
            output = output + "Photo Title : " + nextPhoto.getAttribute(new QName("title")).getAttributeValue()
                    + "\nPhoto URL : " + nextPhoto.getAttribute(new QName("url")).getAttributeValue() + "\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 flickrGroupsPoolsGetGroups(String page, String perPage, String sharedSecret, String token,
        String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token + "formatrest" + "method"
            + "flickr.groups.pools.getGroups";
    GroupsPoolsGetGroups groupsPoolsGetGroups = new GroupsPoolsGetGroups();
    groupsPoolsGetGroups.setApi_key(key);
    groupsPoolsGetGroups.setAuth_token(token);
    if (!"".equals(page.trim())) {
        groupsPoolsGetGroups.setPage(new BigInteger(page));
        sig = sig + "page" + page;
    }//from w w  w.  j a  v  a 2  s . c o  m
    if (perPage != null && !"".equals(perPage.trim())) {

        groupsPoolsGetGroups.setPer_page(new BigInteger(perPage));
        sig = sig + "per_page" + perPage;
    }
    String output = "";
    try {
        groupsPoolsGetGroups.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrGroupsPoolsGetGroups(groupsPoolsGetGroups);
        StatType statType = response.getStat();
        Token retToken = statType.getValue();
        if (retToken.equals(StatType._ok)) {
            OMElement[] elements = response.getExtraElement();
            for (int i = 0; i < elements.length; i++) {
                OMElement groups = elements[i];
                output = "List of groups to which you can add photos\n\n" + "Total number of groups : "
                        + groups.getAttribute(new QName("total")).getAttributeValue() + "\n";
                Iterator iter = groups.getChildElements();
                while (iter.hasNext()) {
                    OMElement group = (OMElement) iter.next();
                    output = output + "Group \nGroup ID : "
                            + group.getAttribute(new QName("nsid")).getAttributeValue() + "\nGroup Name : "
                            + group.getAttribute(new QName("name")).getAttributeValue() + "\n" + "Privacy : "
                            + group.getAttribute(new QName("privacy")).getAttributeValue() + "\nPhotos : "
                            + group.getAttribute(new QName("photos")).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 flickrPhotosGetInfo(String photoID, String secret, String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosGetInfo photosGetInfo = new PhotosGetInfo();
    photosGetInfo.setApi_key(key);//www.  j  av  a 2  s .com
    photosGetInfo.setPhoto_id(photoID);
    photosGetInfo.setSecret(secret);
    String output = "";
    try {
        Rsp response = flickrServiceStub.flickrPhotosGetInfo(photosGetInfo);
        StatType statType = response.getStat();
        Token token = statType.getValue();
        if (token.equals(StatType._ok)) {
            OMElement[] elements = response.getExtraElement();
            for (int i = 0; i < elements.length; i++) {
                OMElement photo = elements[i];
                output = "Information of the photo\n\n";
                output = output + "Photo ID : " + photo.getAttribute(new QName("id")).getAttributeValue()
                        + "\nSecret : " + photo.getAttribute(new QName("secret")).getAttributeValue() + "\n";
                OMElement owner = photo.getFirstChildWithName(new QName("owner"));
                output = output + "Owner name : "
                        + owner.getAttribute(new QName("realname")).getAttributeValue() + "\n";
                output = output + "Owner Location : "
                        + owner.getAttribute(new QName("location")).getAttributeValue() + "\n";
                OMElement title = photo.getFirstChildWithName(new QName("title"));
                output = output + "Title : " + title.getText() + "\n";
                OMElement description = photo.getFirstChildWithName(new QName("description"));
                output = output + "Description : " + description.getText() + "\n";
                OMElement dates = photo.getFirstChildWithName(new QName("dates"));
                output = output + "Date Taken : " + dates.getAttribute(new QName("taken")).getAttributeValue()
                        + "\n";
                OMElement notes = photo.getFirstChildWithName(new QName("notes"));
                Iterator iter = notes.getChildElements();
                while (iter.hasNext()) {
                    OMElement note = (OMElement) iter.next();
                    output = output + "Note : \n" + "Author Name : "
                            + note.getAttribute(new QName("authorname")).getAttributeValue() + "\n"
                            + "Author note : " + note.getText() + "\n";
                }
                OMElement tags = photo.getFirstChildWithName(new QName("tags"));
                Iterator iter2 = tags.getChildElements();
                while (iter2.hasNext()) {
                    OMElement tag = (OMElement) iter2.next();
                    output = output + "Tag : \n" + "Tag ID : "
                            + tag.getAttribute(new QName("id")).getAttributeValue() + "\n" + "Tag Author ID : "
                            + tag.getAttribute(new QName("author")).getAttributeValue() + "\n" + "Tag Text : "
                            + tag.getText() + "\n";
                }
                OMElement urls = photo.getFirstChildWithName(new QName("urls"));
                Iterator iter3 = urls.getChildElements();
                while (iter3.hasNext()) {
                    OMElement url = (OMElement) iter3.next();
                    output = output + "Url : " + url.getText() + "\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 flickrPhotosAddTags(String photoID, String tags, String sharedSecret, String token, String key,
        String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosAddTags photosAddTags = new PhotosAddTags();
    photosAddTags.setApi_key(key);/* ww  w. j av  a  2s  .c  o  m*/
    photosAddTags.setPhoto_id(photoID);
    photosAddTags.setTags(tags);
    photosAddTags.setAuth_token(token);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token + "formatrest" + "method"
            + "flickr.photos.addTags" + "photo_id" + photoID + "tags" + tags;

    String output = "";
    try {
        photosAddTags.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrPhotosAddTags(photosAddTags);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            output = "Tags added 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 flickrPhotosDelete(String photoID, String sharedSecret, String token, String key, String host,
        String port) {//from   ww w  . ja va 2  s.co m
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosDelete photosDelete = new PhotosDelete();
    photosDelete.setApi_key(key);
    photosDelete.setPhoto_id(photoID);
    photosDelete.setAuth_token(token);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token + "formatrest" + "method"
            + "flickr.photos.delete" + "photo_id" + photoID;

    String output = "";
    try {
        photosDelete.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrPhotosDelete(photosDelete);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            output = "Photo deleted 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 flickrPhotosGetAllContexts(String photoID, String sharedSecret, String token, String key,
        String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosGetAllContexts photosGetAllContexts = new PhotosGetAllContexts();
    photosGetAllContexts.setApi_key(key);
    photosGetAllContexts.setPhoto_id(photoID);
    String output = "";
    try {// w w w.  java  2  s  .  co  m
        Rsp response = flickrServiceStub.flickrPhotosGetAllContexts(photosGetAllContexts);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            OMElement[] elements = response.getExtraElement();

            OMElement set = elements[0];
            output = "Visible sets and pools the photo belongs to.\n\n";
            output = output + "Set ID : " + set.getAttribute(new QName("id")).getAttributeValue() + "\nTitle : "
                    + set.getAttribute(new QName("title")).getAttributeValue() + "\n";
            OMElement photo = elements[1];
            output = output + "Pool ID : " + photo.getAttribute(new QName("id")).getAttributeValue()
                    + "\nTitle : " + photo.getAttribute(new QName("title")).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 flickrPhotosGetContactsPhotos(String count, boolean friends, boolean single, boolean self,
        ExtrasBean extrasBean, String sharedSecret, String token, String key, String host, String port) {
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    String sig = sharedSecret + "api_key" + key + "auth_token" + token;
    PhotosGetContactsPhotos photosGetContactsPhotos = new PhotosGetContactsPhotos();
    photosGetContactsPhotos.setApi_key(key);
    if (count != null) {
        photosGetContactsPhotos.setCount(new BigInteger(count));
        sig = sig + "count" + count;
    }/*from w w w . j a va2 s  .com*/
    String extras = processExtras(extrasBean);
    sig = sig + "extras" + extras;
    photosGetContactsPhotos.setExtras(extras);
    sig = sig + "formatrest";
    if (self) {
        photosGetContactsPhotos.setInclude_self(new BigInteger("1"));
        sig = sig + "include_self1";
    }
    if (friends) {
        photosGetContactsPhotos.setJust_friends(new BigInteger("1"));
        sig = sig + "just_friends1";
    }
    sig = sig + "method" + "flickr.photos.getContactsPhotos";
    if (single) {
        photosGetContactsPhotos.setSingle_photo(new BigInteger("1"));
        sig = sig + "single_photo1";
    }
    String output = "";
    try {
        photosGetContactsPhotos.setApi_sig(DigestUtils.md5Hex(sig));
        Rsp response = flickrServiceStub.flickrPhotosGetContactsPhotos(photosGetContactsPhotos);
        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 recent photos from the calling users' contacts.\n\n";
                Iterator iterator = photos.getChildElements();
                while (iterator.hasNext()) {
                    OMElement photo = (OMElement) iterator.next();
                    output = "Photo\n" + "Photo ID : " + photo.getAttribute(new QName("id")).getAttributeValue()
                            + "\nOwner : " + photo.getAttribute(new QName("owner")).getAttributeValue() + "\n"
                            + "Secret : " + photo.getAttribute(new QName("secret")).getAttributeValue()
                            + "\nUsername : " + photo.getAttribute(new QName("username")).getAttributeValue()
                            + "\n" + "Title : " + photo.getAttribute(new QName("title")).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 flickrPhotosGetContactsPublicPhotos(String userID, String count, boolean friends, boolean single,
        boolean self, ExtrasBean extrasBean, String sharedSecret, String token, String key, String host,
        String port) {/*  w w  w .j a  va  2 s  . c om*/
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosGetContactsPublicPhotos photosGetContactsPublicPhotos = new PhotosGetContactsPublicPhotos();
    photosGetContactsPublicPhotos.setApi_key(key);
    photosGetContactsPublicPhotos.setUser_id(userID);
    if (count != null) {
        photosGetContactsPublicPhotos.setCount(new BigInteger(count));
    }
    photosGetContactsPublicPhotos.setExtras(processExtras(extrasBean));
    if (self) {
        photosGetContactsPublicPhotos.setInclude_self(new BigInteger("1"));
    }
    if (friends) {
        photosGetContactsPublicPhotos.setJust_friends(new BigInteger("1"));
    }
    if (single) {
        photosGetContactsPublicPhotos.setSingle_photo(new BigInteger("1"));
    }
    String output = "";
    try {
        Rsp response = flickrServiceStub.flickrPhotosGetContactsPublicPhotos(photosGetContactsPublicPhotos);
        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 recent photos from the calling users' contacts.\n\n";
                Iterator iterator = photos.getChildElements();
                while (iterator.hasNext()) {
                    OMElement photo = (OMElement) iterator.next();
                    output = output + "Photo\n";
                    output = output + "Photo ID : " + photo.getAttribute(new QName("id")).getAttributeValue()
                            + "\nOwner : " + photo.getAttribute(new QName("owner")).getAttributeValue() + "\n"
                            + "Secret : " + photo.getAttribute(new QName("secret")).getAttributeValue()
                            + "\nUsername : " + photo.getAttribute(new QName("username")).getAttributeValue()
                            + "\n" + "Title : " + photo.getAttribute(new QName("title")).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 flickrPhotosGetContext(String photoID, String sharedSecret, String token, String key, String host,
        String port) {//  w  ww .  j  ava2s.  co m
    FlickrServiceStub flickrServiceStub = getStub(host, port);
    PhotosGetContext photosGetContext = new PhotosGetContext();
    photosGetContext.setApi_key(key);
    photosGetContext.setPhoto_id(photoID);
    String output = "";
    try {
        Rsp response = flickrServiceStub.flickrPhotosGetContext(photosGetContext);
        StatType statType = response.getStat();
        Token rspToken = statType.getValue();
        if (rspToken.equals(StatType._ok)) {
            OMElement[] elements = response.getExtraElement();

            OMElement prev = elements[0];
            output = "Next and previous photos for this photo which is in a photostream..\n\n";
            output = output + "Previous Photo \nPhoto ID : "
                    + prev.getAttribute(new QName("id")).getAttributeValue() + "\nTitle : "
                    + prev.getAttribute(new QName("title")).getAttributeValue() + "\n";
            output = output + "Secret : " + prev.getAttribute(new QName("secret")).getAttributeValue()
                    + "\nURL : " + prev.getAttribute(new QName("url")).getAttributeValue() + "\n";
            OMElement next = elements[1];
            output = output + "Next Photo \nPhoto ID : "
                    + next.getAttribute(new QName("id")).getAttributeValue() + "\nTitle : "
                    + next.getAttribute(new QName("title")).getAttributeValue() + "\n";
            output = output + "Secret : " + next.getAttribute(new QName("secret")).getAttributeValue()
                    + "\nURL : " + next.getAttribute(new QName("url")).getAttributeValue() + "\n";
        } else {
            output = processPeopleError(response.getErr());
        }
    } catch (RemoteException e) {
        output = e.getMessage();
    }
    return output;
}