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.bbsync.webservice.client.proxytool.ContextProxyTool.java

/**
 * Each installation of Academic Suite has a unique 32-character identifier 
 * associated with it.  You can use this method to retrieve this value for 
 * the target server./*from  w  w w .  jav  a2 s. c  om*/
 * 
 * @return Returns a 32 character String of hex digits.
 */
protected String getSystemInstallationId() {
    GetSystemInstallationIdResponse response = null;
    setupSession();
    try {
        response = contextWS.getSystemInstallationId();
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Get System Installation ID");
        logger.error(e.getMessage());
        return null;
    }
    cleanupSession();
    if (response == null) {
        logger.warn("getSystemInstallationId returned null.");
        return null;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

private String _initialize() {
    InitializeResponse response = null;//from  w  w w  .j  ava2 s  .  c  o  m
    //Don't setupSession() or initializeSession().
    //To use this method, your session should already be active.
    try {
        response = contextWS.initialize();
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Initialize");
        logger.error(e.getMessage());
        return null;
    }
    //don't cleanupSession() here.  Do it at logout().
    if (response == null) {
        logger.warn("initialize returned null.");
        return null;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

private String _initializeVersion2() {
    InitializeVersion2Response response = null;
    //Don't setupSession() or initializeSession().
    //To use this method, your session should already be active.
    try {//from  w  ww.  j ava  2  s.c  o  m
        response = contextWS.initializeVersion2();
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Initialize Version2");
        logger.error(e.getMessage());
        return null;
    }
    //don't cleanupSession() here.  Do it at logout().
    if (response == null) {
        logger.warn("initializeVersion2 returned null.");
        return null;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

/**
 * Logs in user using the given password. ONLY works if the authentication 
 * source is the internal AS database./*from  w w  w. j  a v  a  2  s . c om*/
 * 
 * @param user_name - The user name/login ID of the user, not the internal
 *                    Blackboard ID.
 * @param password - The password associated with the given user name.
 * @param client_vendor_id - the "clientVendorId" as defined in conf.xml
 * @param proxy_tool_name  - the registered name of the proxy tool.  See 
 *                           <ClassConfig name=" ... "> in conf.xml
 * @param login_extra_info - not used at this time.
 * @param timeout_seconds  - The number of seconds to keep this session
 *                           object valid - see "sessionTimeOutSeconds" in
 *                           conf.xml to configure the default timeout 
 *                           value.  You can call extendSessionLife() to 
 *                           keep a session alive longer.
 *                           
 * @return If successful, establishes a user-authenticated session valid for 
 *         use in other calls and returns true. Otherwise returns false.
 */
protected boolean login(String user_name, String user_password, String client_vendor_id, String tool_name,
        String login_extra_info, Long timeout_seconds) {
    LoginResponse response = null;
    Login login = new Login();
    login.setClientProgramId(tool_name);
    login.setClientVendorId(client_vendor_id);
    login.setExpectedLifeSeconds(timeout_seconds);
    login.setLoginExtraInfo(login_extra_info);
    login.setPassword(user_password);
    login.setUserid(user_name);
    setupSession();
    initializeSession();
    try {
        response = contextWS.login(login);
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Login");
        logger.error(e.getMessage());
        return false;
    }
    //don't cleanupSession() here.  Do it at logout().
    if (response == null) {
        logger.warn("login returned null.");
        return false;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

/**
 * Logs in a session based on the given ticket. The ticket will contain 
 * information about the user it is authenticated for as well as timestamp
 * information. It is only valid for a short time after it is generated 
 * (i.e. approximately 5 minutes) so you should be sure to use it 
 * immediately to get a sessionid if you are unsure how long it will be in
 * your client application before you need the Web Service session.
 * /*from www.  j  a va  2s.  c  om*/
 * @param ticket - Ticket provided during proxy tool negotiation.
 * @param client_vendor_id - the "clientVendorId" as defined in conf.xml
 * @param proxy_tool_name  - the registered name of the proxy tool.  See 
 *                           <ClassConfig name=" ... "> in conf.xml
 * @param login_extra_info - not used at this time.
 * @param timeout_seconds  - The number of seconds to keep this session
 *                           object valid - see "sessionTimeOutSeconds" in
 *                           conf.xml to configure the default timeout 
 *                           value.  You can call extendSessionLife() to 
 *                           keep a session alive longer.
 *                           
 * @return If successful, establishes an authenticated session valid for 
 *         use in other calls (either tool or user based - depends on 
 *         ticket) and returns true.  Otherwise, returns false.
 */
protected boolean loginTicket(String ticket, String client_vendor_id, String proxy_tool_name,
        String login_extra_info, Long timeout_seconds) {
    LoginTicketResponse response = null;
    LoginTicket login = new LoginTicket();
    login.setClientProgramId(proxy_tool_name);
    login.setClientVendorId(client_vendor_id);
    login.setExpectedLifeSeconds(timeout_seconds);
    login.setLoginExtraInfo(login_extra_info);
    login.setTicket(ticket);
    setupSession();
    initializeSession();
    try {
        response = contextWS.loginTicket(login);
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Login Ticket");
        logger.error(e.getMessage());
        return false;
    }
    //don't cleanupSession() here.  Do it at logout().
    if (response == null) {
        logger.warn("loginTicket returned null.");
        return false;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

/**
 * Login using tool-based authentication.
 * @param shared_secret - see the "sharedSecret" parameter as defined in
 *                        conf.xml for the specific proxy tool.  
 * @param client_vendor_id - the "clientVendorId" as defined in conf.xml
 * @param proxy_tool_name  - the registered name of the proxy tool.  See 
 *                           <ClassConfig name=" ... "> in conf.xml
 * @param login_extra_info - not used at this time.
 * @param timeout_seconds  - The number of seconds to keep this session
 *                           object valid - see "sessionTimeOutSeconds" in
 *                           conf.xml to configure the default timeout 
 *                           value.  You can call extendSessionLife() to 
 *                           keep a session alive longer.
 *                           //  w  ww . j a v  a  2s.  c o m
 * @return If successful, establishes a tool-authenticated session valid for 
 *         use in other calls and returns true.  Otherwise, returns false.
 */
protected boolean loginTool(String shared_secret, String client_vendor_id, String tool_name,
        String login_extra_info, Long timeout_seconds) {
    LoginTool loginArgs = new LoginTool();
    loginArgs.setPassword(shared_secret);
    loginArgs.setClientVendorId(client_vendor_id);
    loginArgs.setClientProgramId(tool_name);
    loginArgs.setLoginExtraInfo(login_extra_info);
    loginArgs.setExpectedLifeSeconds(timeout_seconds);
    LoginToolResponse response = null;
    setupSession();
    initializeSession();
    try {
        response = contextWS.loginTool(loginArgs);
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Login Tool");
        logger.error(e.getMessage());
        return false;
    }
    //don't cleanupSession() here.  Do it at logout().
    if (response == null) {
        logger.warn("loginTool returned null.");
        return false;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

/**
 * This method will destroy the current session rendering 
 * it invalid for use in subsequent operations.
 * @return/*from w  ww  .j a v  a2s. c om*/
 */
protected boolean logout() {
    LogoutResponse response = null;
    try {
        response = contextWS.logout();
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Logout");
        logger.error(e.getMessage());
        return false;
    }

    cleanupSession();
    if (response == null) {
        logger.warn("logout returned null.");
        return false;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

/**
 * Register your client program with the Academic Suite server. The list of
 * required methods is a list of "webservicename:operation" for each 
 * operation you intend to call on each webservice. The requiredToolMethods
 * are those you call from a loginTool session while the methods in 
 * requiredTicketMethods are those you call from a loginTicket session. You
 * do not have to declare requiredUserMethods because you will get whatever
 * entitlements the user has if you provide their password as part of the 
 * login method. /*  ww  w  .  j  a va 2 s  .c o m*/
 * After calling this registration method from your client program 
 * installer, the Academic Suite administrator will have to login and make 
 * the tool available before you can login as a tool (via loginTool) and 
 * get the entitlements associated with the methods you requested.
 * 
 * NOTE that this call will only succeed BEFORE a password is assigned to 
 * your tool. Once a password is assigned you cannot re-register to change 
 * your desired entitlements (by declaring a different set of methods being
 * used). If you are testing your tool and wish to change entitlements you 
 * have to first clear the password in the UI, then call registerTool, then
 * set the password again. Be careful setting the initial password as there 
 * are several sets of rules around this: 
 * 1) If you register without a password and without placements (i.e no 
 *    tool-profile xml in the description) then your proxy tool is 
 *    'available' by default, but you can only use the login(user/pw) 
 *    method. 
 * 2) If you register with a password or with placements then your proxy 
 *    tool is either 'unavailable' (no placements) or 'inactive' (with 
 *    placements). You cannot login using any methods in this state. 
 * 3) Once your tool is registered, you cannot call this method as long as 
 *    there is a password set on your tool unless you are being asked to 
 *    via the reregister proxy-tool callback operation. 
 * 4) If you are calling this as part of the reregister operation, the 
 *    initialsharedsecret is ignored.
 *
 *@param client_vendor_id - Your vendor ID. You will use this same ID in 
 *                          any login calls.
 *@param client_program_id - Your program ID (should be unique per client 
 *                           program/Web Service agent you develop). You 
 *                           will use this ID in any login calls.
 *@param registration_password - If required by the AS administrator you 
 *                               may need a special password to register 
 *                               tools.
 *@param description - A longer description of your client program 
 *                     (displayed to the administrator on the manage agent 
 *                     page). When registering a Proxy Tool, the 
 *                     description field must be the Proxy Tool XML 
 *                     description for your tool. When registering a Proxy 
 *                     Tool with an XML descriptor, specify the operations 
 *                     in the registerTool method or in the XML or both. If
 *                     you specify in both places, the list of operations 
 *                     is merged together. Blackboard recommends specifying
 *                     them in the XML because that is the only place where
 *                     the list of 'webservices requested' is generated in 
 *                     the administrator UI.
 *@param initial_shared_secret - the initial shared secret to be used by 
 *                               this tool (note that the administrator has
 *                               to make the tool 'available' before you 
 *                               can use this password and they can also 
 *                               change it through the edit proxy tool UI). 
 *                               Also, if you are re-registering then this 
 *                               password is ignored - only valid for the 
 *                               Initial registration.
 *@param required_tool_methods - An array of webservice methods that you 
 *                               will use when logged in as a tool.
 *@param required_ticket_methods - An array of webservice methods that you 
 *                                 will use when logged in as a user via 
 *                                 the loginTicket method.
 *@return Returns a RegisterToolResultVO: 
 *        success=true  - successfully registered
 *        success=false - failed to register
 *        proxyToolGuid = the GUID for this proxy tool if the tool being 
 *                        registered is a proxy tool.  This guid is a 
 *                        unique identifier generated by Academic Suite 
 *                        associated with this tool registration. You must 
 *                        record this GUID and use it to correlate future 
 *                        requests from the server with your local 
 *                        configuration.
 */
protected RegisterToolResultVO registerTool(String client_vendor_id, String client_program_id,
        String registration_password, String description, String initial_shared_secret,
        String[] required_tool_methods, String[] required_ticket_methods) {
    RegisterTool register_tool = new RegisterTool();
    register_tool.setClientProgramId(client_program_id);
    register_tool.setClientVendorId(client_vendor_id);
    register_tool.setDescription(description);
    register_tool.setInitialSharedSecret(initial_shared_secret);
    register_tool.setRegistrationPassword(registration_password);
    register_tool.setRequiredToolMethods(required_tool_methods);
    register_tool.setRequiredTicketMethods(required_ticket_methods);
    RegisterToolResponse response = null;
    setupSession();
    try {
        response = contextWS.registerTool(register_tool);
    } catch (RemoteException e) {
        logger.error("Encountered a remote exception while trying to Register Tool");
        logger.error(e.getMessage());
        return null;
    }
    cleanupSession();
    if (response == null) {
        logger.warn("registerTool returned null.");
        return null;
    }
    return response.get_return();
}

From source file:org.bbsync.webservice.client.proxytool.ContextProxyTool.java

/**
 * Whenever a session is successfully logged in, resources are allocated in
 * the Axis2 ConfigurationContext.  Unfortunately, these resources will
 * persist even after invoking the logout() method.  After invoking 
 * logout(), this method will cleanup the ConfigurationContext and release 
 * all of it's resources.//from   w w w.j a  v a2 s . com
 * 
 * @return Returns true when the configuration Context has been cleaned up 
 *         successfully. Otherwise, returns false. 
 */
private boolean cleanupSession() {
    try {
        ctx.cleanupContexts(); //Called during shutdown to clean up all Contexts
        ctx.flush(); //(part of superclass AbstractContext)
        ctx.terminate(); //Invoked during shutdown to stop the ListenerManager and perform configuration cleanup
    } catch (RemoteException e) {
        logger.error("Encountered an error while attempting to cleanup the configuration context: "
                + e.getMessage());
        session_id = null;
        ctx = null;
        return false;
    }
    ctx = null;
    session_id = null;
    return true;
}

From source file:org.emonocot.portal.controller.SearchController.java

@RequestMapping(value = "/ncbi", method = RequestMethod.GET, consumes = "application/json", produces = "application/json")
public ResponseEntity<NcbiDto> ncbi(@RequestParam(value = "query", required = true) String query) {
    NcbiDto ncbiDto = new NcbiDto();
    try {//ww  w . ja  v  a  2  s  .  c  om
        ncbiDto = ncbiService.issueRequest(query);
    } catch (RemoteException re) {
        logger.error("Exception using NCBI Service :" + re.getMessage(), re);
        return new ResponseEntity<NcbiDto>(HttpStatus.INTERNAL_SERVER_ERROR);
    }

    return new ResponseEntity<NcbiDto>(ncbiDto, HttpStatus.OK);
}