List of usage examples for java.rmi RemoteException RemoteException
public RemoteException(String s, Throwable cause)
From source file:org.globus.examples.services.filebuy.seller.impl.FilesForSaleService.java
private FileResource getResource() throws RemoteException { Object resource = null;//from w w w.j a va 2 s . co m try { resource = ResourceContext.getResourceContext().getResource(); } catch (NoSuchResourceException e) { throw new RemoteException("Specified resource does not exist", e); } catch (ResourceContextException e) { throw new RemoteException("Error during resource lookup", e); } catch (Exception e) { throw new RemoteException("", e); } FileResource fileResource = (FileResource) resource; return fileResource; }
From source file:org.globus.examples.services.filebuy.seller.impl.FilesForSaleService.java
public FillOrderResponse fillOrder(FillOrder params) throws RemoteException { // Retrieve parameters EndpointReferenceType buyerEPR = params.getBuyerEPR(); logger.debug("fillOrder invoked"); /*/*from w w w . jav a2 s .com*/ * INVOKE FILE TRANSFER SERVICE */ // Create transfer service EPR // (Transfer service URI is in the configuration object) FilesForSaleConfiguration conf = null; try { conf = FilesForSaleConfiguration.getConfObject(); } catch (Exception e) { logger.error("ERROR: Unable to obtain FilesForSale configuration object (JNDI)."); throw new RemoteException("ERROR: Unable to obtain FilesForSale configuration object (JNDI).", e); } String transferURI = conf.getTransferURI(); EndpointReferenceType indexEPR = new EndpointReferenceType(); try { indexEPR.setAddress(new Address(transferURI)); } catch (Exception e) { logger.error("ERROR: Malformed transfer URI '" + transferURI + "'"); throw new RemoteException("ERROR: Malformed transfer URI '" + transferURI + "'", e); } // Get FileTransfer portType FileTransferServiceAddressingLocator transferLocator; transferLocator = new FileTransferServiceAddressingLocator(); FileTransferPortType transfer = null; try { transfer = transferLocator.getFileTransferPortTypePort(indexEPR); } catch (ServiceException e) { logger.error("ERROR: Unable to obtain transfer portType."); throw new RemoteException("ERROR: Unable to obtain transfer portType.", e); } // Setup security options ((Stub) transfer)._setProperty(Constants.GSI_TRANSPORT, Constants.SIGNATURE); ((Stub) transfer)._setProperty(Constants.AUTHORIZATION, NoAuthorization.getInstance()); // Retrieve file name and location from File resource FileResource file = getResource(); String fileName = file.getName(); String fileLocation = file.getLocation(); logger.debug("Requesting transfer of file " + fileName + " to " + buyerEPR.getAddress()); /* Invoke Transfer operation */ // Create request to Transfer operation Transfer transferRequest = new Transfer(); transferRequest.setName(fileName); transferRequest.setLocation(fileLocation); transferRequest.setBuyerEPR(buyerEPR); // Perform invocation try { transfer.transfer(transferRequest); } catch (RemoteException e) { logger.error("ERROR: Unable to invoke Transfer operation."); throw new RemoteException("ERROR: Unable to invoke Transfer operation.", e); } logger.debug("fillOrder completed successfully"); return new FillOrderResponse(); }
From source file:org.globus.examples.services.filebuy.transfer.impl.FileTransferService.java
public TransferResponse transfer(Transfer params) throws RemoteException { /* Retrieve parameters */ String name = params.getName(); String location = params.getLocation(); EndpointReferenceType buyerEPR = params.getBuyerEPR(); /*// w w w.j a v a 2s .c om * INVOKE TRANSFER OPERATION IN BUYER */ // Get FileBuyer portType FileBuyerServiceAddressingLocator buyerLocator; buyerLocator = new FileBuyerServiceAddressingLocator(); FileBuyerPortType buyerPortType = null; try { buyerPortType = buyerLocator.getFileBuyerPortTypePort(buyerEPR); } catch (ServiceException e) { logger.error("ERROR: Unable to obtain buyer portType."); throw new RemoteException("ERROR: Unable to obtain buyer portType.", e); } // Read file to transfer byte[] fileBytes = null; try { File file = new File(location); FileInputStream fis = new FileInputStream(file); fileBytes = new byte[fis.available()]; fis.read(fileBytes); } catch (IOException e) { logger.error("ERROR: Unable to open file to transfer."); throw new RemoteException("ERROR: Unable to open file to transfer.", e); } // Create request to Transfer operation org.globus.examples.stubs.filebuy.FileBuyer.Transfer transferRequest; transferRequest = new org.globus.examples.stubs.filebuy.FileBuyer.Transfer(); transferRequest.setName(name); transferRequest.setData(fileBytes); // Perform invocation try { buyerPortType.transfer(transferRequest); } catch (RemoteException e) { logger.error("ERROR: Unable to invoke Transfer operation."); throw new RemoteException("ERROR: Unable to invoke Transfer operation.", e); } return new TransferResponse(); }
From source file:org.jaggeryjs.integration.common.clients.ServiceAdminClient.java
public boolean deleteFaultyService(String archiveName) throws RemoteException { try {//from w ww .j a va 2s . c o m return serviceAdminStub.deleteFaultyServiceGroup(archiveName); } catch (RemoteException e) { log.error("Faulty service deletion fails", e); throw new RemoteException("Faulty service deletion fails", e); } }
From source file:org.jaggeryjs.integration.common.clients.ServiceAdminClient.java
public boolean deleteFaultyServiceByServiceName(String serviceName) throws RemoteException { try {/*from w w w .j a va 2s . co m*/ return serviceAdminStub.deleteFaultyServiceGroup(getFaultyData(serviceName).getArtifact()); } catch (RemoteException e) { log.error("Faulty service deletion fails", e); throw new RemoteException("Faulty service deletion fails", e); } }
From source file:org.jaggeryjs.integration.common.clients.ServiceAdminClient.java
public FaultyServicesWrapper getFaultyServiceArchives(int pageNumber) throws RemoteException { FaultyServicesWrapper faultyServicesWrapper; try {/* w ww . j a v a 2 s . c om*/ faultyServicesWrapper = serviceAdminStub.getFaultyServiceArchives(pageNumber); } catch (RemoteException e) { log.error("Unable to get faulty service Archives", e); throw new RemoteException("Unable to get faulty service Archives", e); } return faultyServicesWrapper; }
From source file:org.jaggeryjs.integration.common.clients.WebAppAdminClient.java
public void deleteFaultyWebApps(String fileName) throws RemoteException { try {/*from w ww . ja va 2 s . c o m*/ webappAdminStub.deleteFaultyWebapps(new String[] { fileName }); } catch (RemoteException e) { throw new RemoteException("Faulty webApp deletion fail", e); } }
From source file:org.jbpm.bpel.tutorial.invoice.ComputePricePT_Impl.java
public void sendShippingPrice(ShippingInfo shippingInfo) throws RemoteException { try {/* ww w .j a v a 2s . c o m*/ sendInvoiceMessage(shippingInfo.getShippingPrice()); } catch (JMSException e) { throw new RemoteException("Internal server failure", e); } }
From source file:org.jbpm.bpel.tutorial.shipping.ShippingPT_Impl.java
/** * Returns shipping price sychronously and date asynchronously. *//*from w w w.jav a 2 s .c o m*/ public ShippingInfo requestShipping(CustomerInfo customerInfo) throws ProblemInfo, RemoteException { // check the address before accepting the shipping String address = customerInfo.getAddress(); if (address.indexOf("Elm St") != -1) { // we do not ship to Elm St, it is a scary place throw new ProblemInfo("Shipping unavailable to address: " + address); } try { sendShippingMessage(customerInfo.getCustomerId()); } catch (JMSException e) { throw new RemoteException("Internal server failure", e); } ShippingInfo shippingInfo = new ShippingInfo(); shippingInfo.setShippingPrice(shippingPrice); return shippingInfo; }
From source file:org.jgentleframework.utils.ExceptionUtils.java
/** * Wrap the given arbitrary exception that happened during remote access in * either a RemoteException or a {@link RemoteAccessException} (if the * method signature does not support RemoteException). * <p>//from w w w .java 2 s.c o m * Only call this for remote access exceptions, not for exceptions thrown by * the target service itself! * * @param method * the invoked method * @param ex * the exception that happened, to be used as cause for the * RemoteAccessException or RemoteException * @param message * the message for the RemoteAccessException respectively * RemoteException * @return the exception to be thrown to the caller */ public static Exception convertRmiAccessException(Method method, Throwable ex, String message) { if (log.isDebugEnabled()) { log.debug(message, ex); } if (ReflectUtils.isDeclaredException(method, RemoteException.class)) { return new RemoteException(message, ex); } else { return new RemoteAccessException(message, ex); } }