List of usage examples for java.rmi RemoteException RemoteException
public RemoteException(String s)
From source file:com.symbian.driver.remoting.master.MasterRemoteImpl.java
/** * /* w ww . ja v a 2 s . c o m*/ * @see com.symbian.driver.remoting.master.MasterRemote#getResults(int) */ public TestResultSet getResults(int aTestJobId) throws RemoteException { String lStatus = null; TestResultSet lTestResultSet = null; if ((JobTracker.isTrackable(aTestJobId))) { lStatus = JobTracker.queryStatus(aTestJobId); if ((lStatus.equals(TestJob.COMPLETED)) || (lStatus.equals(TestJob.FAILED))) { try { lTestResultSet = new TestResultSet(new Integer(aTestJobId)); lTestResultSet.Embed(); } catch (IOException lE) { LOGGER.log(Level.SEVERE, "Master: Failed to send results for job " + aTestJobId + " on a client request.", lE); throw new RemoteException(lE.getMessage()); } catch (ParseException lE) { LOGGER.log(Level.SEVERE, "Master: Error reading Preferences.", lE); throw new RemoteException(lE.getMessage()); } } else { return null; } } else { return null; } return lTestResultSet; }
From source file:org.ow2.proactive.connector.iaas.cloud.provider.vmware.VMWareProvider.java
@Override public List<ScriptResult> executeScriptOnInstanceId(Infrastructure infrastructure, String instanceId, InstanceScript instanceScript) { List<ScriptResult> scriptResults = new ArrayList<>(); try {/*w w w.java2 s . c o m*/ VirtualMachine vm = vmWareProviderVirtualMachineUtil .searchVirtualMachineByUUID(instanceId, vmWareServiceInstanceCache.getServiceInstance(infrastructure).getRootFolder()) .orElseThrow(() -> new RemoteException("Unable to find VM with UUID: " + instanceId)); GuestOperationsManager gom = vmWareServiceInstanceCache.getServiceInstance(infrastructure) .getGuestOperationsManager(); NamePasswordAuthentication npa = new NamePasswordAuthentication(); npa.username = instanceScript.getCredentials().getUsername(); npa.password = instanceScript.getCredentials().getPassword(); npa.interactiveSession = false; for (int i = 0; i < instanceScript.getScripts().length; i++) { ScriptResult scriptResult = new ScriptResult(instanceId, "", ""); GuestProgramSpec gps = new GuestProgramSpec(); gps.programPath = "/bin/bash"; gps.arguments = instanceScript.getScripts()[i]; GuestProcessManager gpm = gom.getProcessManager(vm); scriptResult = scriptResult.withOutput( (scriptResult.getOutput() + " " + String.valueOf(gpm.startProgramInGuest(npa, gps))) .trim()); scriptResults.add(scriptResult); } } catch (RemoteException e) { throw new RuntimeException( "ERROR when executing the script: " + instanceScript + " against instance id: " + instanceId, e); } return scriptResults; }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
@Override public WSVersion getComponentVersion(WSGetComponentVersion wsGetComponentVersion) throws RemoteException { try {/*w w w . j ava 2 s .c o m*/ if (WSComponent.DataManager.equals(wsGetComponentVersion.getComponent())) { Version version = Version.getVersion(this.getClass()); return new WSVersion(version.getMajor(), version.getMinor(), version.getRevision(), version.getBuild(), version.getDescription(), version.getDate()); } throw new RemoteException( "Version information is not available yet for " + wsGetComponentVersion.getComponent() //$NON-NLS-1$ + " components"); //$NON-NLS-1$ } catch (RemoteException e) { throw (e); } catch (Exception e) { throw new RemoteException( (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage())); } }
From source file:gov.nih.nci.cagrid.identifiers.service.IdentifiersNAServiceImpl.java
/***************************** * This method is used to add an identifier to a site. This method is an * authentication oriented operation. The identifier should exists in the * database./*from w w w . jav a2 s .c om*/ * * @param identifier * is an existing GSID to which you would like to attach your * site data. * @return * @throws RemoteException * @throws gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthorityConfigurationFault * @throws gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierValuesFault * @throws gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierFault * @throws gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthoritySecurityFault */ public org.apache.axis.types.URI addSite(java.lang.String identifier) throws RemoteException, gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthorityConfigurationFault, gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierValuesFault, gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierFault, gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthoritySecurityFault { LOG.info("addSite: USER=========[" + SecurityManager.getManager().getCaller() + "]"); SecurityInfo secInfo = new SecurityInfoImpl(SecurityManager.getManager().getCaller()); try { namingAuthority.addSite(secInfo, identifier); } catch (NamingAuthorityConfigurationException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (InvalidIdentifierException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (NamingAuthoritySecurityException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (InvalidIdentifierValuesException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (Exception e) { e.printStackTrace(); throw new RemoteException(e.toString()); } return null; }
From source file:com.amalto.core.delegator.IXtentisWSDelegator.java
@Override public WSString ping(WSPing wsPing) throws RemoteException { if ("Studio".equals(wsPing.getEcho())) {//$NON-NLS-1$ check view user can't use studio try {/*from w w w . j a va2 s .c om*/ if (LocalUser.getLocalUser().getRoles().contains(XSystemObjects.ROLE_DEFAULT_VIEWER.getName())) { throw new RemoteException("Viewer user can't use MDM Studio!"); //$NON-NLS-1$ } } catch (Exception e) { throw new RemoteException(e.getLocalizedMessage(), e); } } return new WSString(wsPing.getEcho()); }
From source file:com.urbancode.terraform.tasks.aws.helpers.AWSHelper.java
/** * Waits for the instance to reach the specified state (e.g. running, terminated, etc) * The timeout is specified in minutes.//w w w .ja v a 2 s.co m * * @param instanceId * @param expectedState * @param timeout * @param ec2Client */ public void waitForState(String instanceId, String expectedState, int timeout, AmazonEC2 ec2Client) throws RemoteException, InterruptedException { long pollInterval = 5000L; long timeoutInterval = timeout * 60L * 1000L; long start = System.currentTimeMillis(); String state = expectedState + "a"; log.info("Waiting for instance " + instanceId + " to reach " + expectedState + " state"); while (!state.equals(expectedState)) { if (System.currentTimeMillis() - start > timeoutInterval) { log.fatal("Instance " + instanceId + " never reached " + expectedState); throw new RemoteException("Timeout while waiting for instance to hit " + expectedState + " state."); } Instance instance = getInstanceById(instanceId, ec2Client); if (instance != null) { state = instance.getState().getName(); if (instance.getStateReason() != null && "Server.InternalError".equals(instance.getStateReason().getCode())) { throw new RemoteException(instance.getStateReason().getMessage()); } } Thread.sleep(pollInterval); } log.info("Instance " + instanceId + " is now in " + state + " state"); }
From source file:gov.nih.nci.cagrid.identifiers.service.IdentifiersNAServiceImpl.java
/********************************** * This method is used to generate a batch of identifiers. This method is a * non authentication oriented operation. * /* w ww .j ava2s.com*/ * @param numOfIdentifiers * is the number of identifiers you are requesting for should be * between 1 and 100. * @return array of identifiers. * @throws RemoteException * @throws gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthorityConfigurationFault * @throws gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthoritySecurityFault */ public java.lang.String[] generateIdentifiers(int numOfIdentifiers) throws RemoteException, gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthorityConfigurationFault, gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthoritySecurityFault { LOG.info("generateIdentifiers: USER=========[" + SecurityManager.getManager().getCaller() + "]"); SecurityInfo secInfo = new SecurityInfoImpl(SecurityManager.getManager().getCaller()); try { return namingAuthority.createBatchIdentifiers(secInfo, numOfIdentifiers); } catch (NamingAuthorityConfigurationException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (InvalidIdentifierException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (NamingAuthoritySecurityException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (InvalidIdentifierValuesException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (Exception e) { e.printStackTrace(); throw new RemoteException(e.toString()); } }
From source file:org.ow2.proactive.connector.iaas.cloud.provider.vmware.VMWareProvider.java
private VirtualMachine cloneVM(VirtualMachine vm, String newVMname, Instance instance, Folder rootFolder, VirtualMachineCloneSpec vmcs, Folder vmFolder) { try {/*from w w w . j a v a 2 s. c o m*/ // Clone the VM : call to VMWare API Task task = vm.cloneVM_Task(vmFolder, newVMname, vmcs); String result = task.waitForTask(); if (!Task.SUCCESS.equals(result)) { throw new RuntimeException( "Unable to create VMWare instance with : " + instance + " Task result = " + result); } return vmWareProviderVirtualMachineUtil.searchVirtualMachineByName(newVMname, rootFolder) .orElseThrow(() -> new RemoteException("Unable to find the new VM: '" + newVMname + "'")); } catch (RemoteException | InterruptedException e) { throw new RuntimeException("ERROR when creating VMWare instance with : " + instance, e); } }
From source file:gov.nih.nci.cagrid.identifiers.service.IdentifiersNAServiceImpl.java
/**************************************** * This method is used to get the parent hierarchy details about the * identifiers. This method is a non authentication oriented operation. * /*from w w w. ja v a 2 s. c o m*/ * @param identifier * is the GSID for which you would like to get parent hierarchy * information. * @return a tree representing the parent hierarchy. * @throws RemoteException * @throws gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthorityConfigurationFault * @throws gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthoritySecurityFault * @throws gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierValuesFault * @throws gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierFault */ public namingauthority.Tree getParentHierarchy(java.lang.String identifier) throws RemoteException, gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthorityConfigurationFault, gov.nih.nci.cagrid.identifiers.stubs.types.NamingAuthoritySecurityFault, gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierValuesFault, gov.nih.nci.cagrid.identifiers.stubs.types.InvalidIdentifierFault { try { LOG.info("getParentHierarchy: USER=========[" + SecurityManager.getManager().getCaller() + "]"); SecurityInfo secInfo = new SecurityInfoImpl(SecurityManager.getManager().getCaller()); Tree parents = namingAuthority.getParentHierarchy(secInfo, identifier.toString()); return convert(parents); } catch (NamingAuthorityConfigurationException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (InvalidIdentifierException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (NamingAuthoritySecurityException e) { e.printStackTrace(); throw IdentifiersNAUtil.map(e); } catch (Exception e) { e.printStackTrace(); throw new RemoteException(e.toString()); } }
From source file:com.urbancode.terraform.tasks.aws.helpers.AWSHelper.java
/** * Waits for an instance to hit a specific status. * Assumes that expected status is either 'ok' or 'impaired' * * @param instanceId/*from w w w .j a v a 2 s . co m*/ * @param expectedStatus * @param timeout * @param ec2Client */ public void waitForStatus(String instanceId, String expectedStatus, int timeout, AmazonEC2 ec2Client) throws RemoteException, InterruptedException { long pollInterval = 3000L; long timeoutInterval = timeout * 60L * 1000L; long start = System.currentTimeMillis(); String status = getInstanceStatus(instanceId, ec2Client); String oppositeStatus = "impaired"; if (expectedStatus.equalsIgnoreCase("impaired")) { oppositeStatus = "ok"; } log.info("Waiting for instance status to reach: " + expectedStatus); while (!expectedStatus.equals(status) || oppositeStatus.equals(status)) { if (System.currentTimeMillis() - start > timeoutInterval) { throw new RemoteException( "Timeout while waiting for instance to hit " + expectedStatus + " status."); } if (status != null) { if (expectedStatus.equals("ok") && status.equals("impaired")) { // instance hit impaired so we should stop and fail throw new RemoteException("Status hit " + status + " before " + expectedStatus); } status = getInstanceStatus(instanceId, ec2Client); Thread.sleep(pollInterval); } else { log.error("Instance has null status!"); return; } } log.info("Instance hit " + status + " status. Stopping now."); }