Package vs.common

Examples of vs.common.SimpleRpcException


                } catch (NoSuchMethodException nsme) {

                  // server error, no such method
                  mresp = new MethodResponse(
                      MethodResponse.ResultCode.REMOTE_OBJECT_EXCEPTION,
                      null, new SimpleRpcException("no such method m=" + methodName));

                } catch (IllegalAccessException iae) {
                 
                  // server error, method not accessible
                  mresp = new MethodResponse(
                      MethodResponse.ResultCode.REMOTE_OBJECT_EXCEPTION,
                      null, new SimpleRpcException("method not accessible, m=" + methodName));
                 
                } catch (InvocationTargetException ite) {
                 
                  // real business object exception
                  mresp = new MethodResponse(
                      MethodResponse.ResultCode.REMOTE_OBJECT_EXCEPTION,
                      null, ite.getTargetException());

                }
              } else {
               
                // server error, invalid method name
                mresp = new MethodResponse(
                    MethodResponse.ResultCode.REMOTE_OBJECT_EXCEPTION,
                    null, new SimpleRpcException("no such method m=" + methodName));
              }
            } else {
             
              // return server error, could not find object
              mresp = new MethodResponse(
                  MethodResponse.ResultCode.SERVER_ERROR,
                  null, new SimpleRpcException("object not found objectId=" + objectId));
            }
          } else {
           
            // return server error, invalid key
            mresp = new MethodResponse(
                MethodResponse.ResultCode.SERVER_ERROR,
                null, new SimpleRpcException("invalid objectId=" + objectId));
          }
         
          // write response
          oos.writeObject(mresp);
          oos.flush();

        }
       
        // finish client serving
        oos.close();
      }

    } catch (UnknownHostException e) {
      throw new SimpleRpcException(e);
    } catch (IOException e) {
      throw new SimpleRpcException(e);
    } catch (ClassNotFoundException e) {
      throw new SimpleRpcException(e);
    } finally {
     
      // close the object output stream
      if (oos != null) {
        try {
View Full Code Here


        response = (MethodResponse)ois.readObject();
     
      } catch (Exception e) {
       
        // wrap transport exception 
        throw new SimpleRpcException(e);
      }
    }
   
    // handle the returning
    if (response != null) {
      ResultCode code = response.getResultCode();

      // success
      if (MethodResponse.ResultCode.SUCCESS.equals(code)) {

        // return value is null
        if (method.getReturnType().equals(Void.TYPE)) {
          assert response.getReturnValue() == null;
          return null;
         
        // return the return value 
        } else {
          assert response.getReturnValue() != null;
          return response.getReturnValue();
        }

      // throw remote object exception  
      } else if (MethodResponse.ResultCode.REMOTE_OBJECT_EXCEPTION.equals(code)) {
        assert response.getExceptionValue() != null;
        throw response.getExceptionValue();
     
      // throw remote server exception
      } else if (MethodResponse.ResultCode.SERVER_ERROR.equals(code)) {
        assert response.getExceptionValue() != null;
        throw response.getExceptionValue();
       
      // throw unknown exception
      } else {
        throw new SimpleRpcException("unknown exception occured");
      }
     
    }
   
    // response is missing altogether
    throw new SimpleRpcException("rpc response is missing");
  }
View Full Code Here

          rih);
     
      return proxy;

    } catch (Exception e) {
      throw new SimpleRpcException("impossible to create proxy to remote object", e);
    }   
  }
View Full Code Here

TOP

Related Classes of vs.common.SimpleRpcException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.