List of usage examples for java.rmi RemoteException RemoteException
public RemoteException(String s)
From source file:org.globus.workspace.remoting.admin.defaults.DefaultRemoteNodeManagement.java
public String listNodes() throws RemoteException { checkActive();// w ww . j a v a 2s . c o m logger.debug("Listing VMM nodes"); final List<ResourcepoolEntry> entries; try { entries = nodeManagement.getNodes(); } catch (NodeManagementDisabled e) { throw new RemoteException(e.getMessage()); } catch (WorkspaceDatabaseException e) { throw new RemoteException(e.getMessage()); } final List<VmmNode> nodes = new ArrayList<VmmNode>(entries.size()); for (ResourcepoolEntry entry : entries) { nodes.add(translateResourcepoolEntry(entry)); } return gson.toJson(nodes); }
From source file:org.globus.workspace.remoting.admin.defaults.DefaultRemoteNodeManagement.java
public String getNode(String hostname) throws RemoteException { if (hostname == null) { throw new IllegalArgumentException("hostname may not be null"); }/*from ww w .ja v a 2 s . c om*/ logger.debug("Listing VMM node " + hostname); final ResourcepoolEntry entry; try { entry = nodeManagement.getNode(hostname); } catch (NodeManagementDisabled e) { throw new RemoteException(e.getMessage()); } catch (WorkspaceDatabaseException e) { throw new RemoteException(e.getMessage()); } return gson.toJson(translateResourcepoolEntry(entry)); }
From source file:org.globus.workspace.remoting.admin.defaults.DefaultRemoteNodeManagement.java
public String updateNodes(String[] hostnames, Boolean active, String pool, Integer memory, String networks) throws RemoteException { if (hostnames == null) { throw new IllegalArgumentException("hostnames may not be null"); }/* www . ja v a 2s . c om*/ if (hostnames.length == 0) { throw new IllegalArgumentException("You must specify at least one VMM node to update"); } if (active == null && pool == null && memory == null && networks == null) { throw new IllegalArgumentException("You must specify at least one node parameter to update"); } final List<NodeReport> reports = new ArrayList<NodeReport>(hostnames.length); for (String hostname : hostnames) { if (hostname == null) { throw new IllegalArgumentException("update request has null node hostname"); } logger.info("Updating VMM node: " + hostname); try { final ResourcepoolEntry entry; try { entry = nodeManagement.updateNode(hostname, pool, networks, memory, active); } catch (NodeManagementDisabled e) { throw new RemoteException(e.getMessage()); } final VmmNode node = translateResourcepoolEntry(entry); reports.add(new NodeReport(hostname, NodeReport.STATE_UPDATED, node)); } catch (NodeInUseException e) { logger.info("VMM node was in use, failed to update: " + hostname); reports.add(new NodeReport(hostname, NodeReport.STATE_NODE_IN_USE, null)); } catch (NodeNotFoundException e) { logger.info("VMM node not found, failed to update: " + hostname); reports.add(new NodeReport(hostname, NodeReport.STATE_NODE_NOT_FOUND, null)); } catch (WorkspaceDatabaseException e) { throw new RemoteException(e.getMessage()); } } return gson.toJson(reports); }
From source file:org.globus.workspace.remoting.admin.defaults.DefaultRemoteNodeManagement.java
private NodeReport _removeNode(String hostname) throws RemoteException { if (hostname == null) { throw new IllegalArgumentException("hostname may not be null"); }//w w w .ja v a 2 s . c o m hostname = hostname.trim(); if (hostname.length() == 0) { throw new IllegalArgumentException("hostname may not be empty"); } logger.info("Removing VMM node: " + hostname); String state; try { if (nodeManagement.removeNode(hostname)) { state = NodeReport.STATE_REMOVED; } else { state = NodeReport.STATE_NODE_NOT_FOUND; } } catch (NodeInUseException e) { logger.warn("Node in use: " + hostname); state = NodeReport.STATE_NODE_IN_USE; } catch (NodeManagementDisabled e) { throw new RemoteException(e.getMessage()); } catch (WorkspaceDatabaseException e) { throw new RemoteException(e.getMessage()); } return new NodeReport(hostname, state, null); }
From source file:org.globus.workspace.remoting.admin.defaults.DefaultRemoteNodeManagement.java
public String getAllNetworkPools(int inUse) throws RemoteException { try {//from w ww .j a v a 2 s . c o m Hashtable cAssociations = persistenceAdapter.currentAssociations(); List<Association> assocs = new ArrayList<Association>(); Enumeration keys = cAssociations.keys(); while (keys.hasMoreElements()) { Association a = (Association) cAssociations.get(keys.nextElement()); assocs.add(a); } if (assocs == null || assocs.size() == 0) return null; List<AssociationEntry> allEntries = new ArrayList<AssociationEntry>(); for (Association assoc : assocs) { Iterator it = assoc.getEntries().iterator(); while (it.hasNext()) { AssociationEntry next = (AssociationEntry) it.next(); if (inUse == ALL_ENTRIES) { allEntries.add(next); } else if (inUse == FREE_ENTRIES) { if (!next.isInUse()) allEntries.add(next); } else if (inUse == USED_ENTRIES) { if (next.isInUse()) allEntries.add(next); } } } if (allEntries == null || allEntries.isEmpty()) return null; return gson.toJson(allEntries); } catch (WorkspaceDatabaseException e) { throw new RemoteException(e.getMessage()); } }
From source file:org.globus.workspace.remoting.admin.defaults.DefaultRemoteNodeManagement.java
public String getNetworkPool(String pool, int inUse) throws RemoteException { try {/*from w ww. j ava 2 s . c om*/ Hashtable cAssociations = persistenceAdapter.currentAssociations(); final Association assoc = (Association) cAssociations.get(pool); if (assoc == null) return null; List<AssociationEntry> entries = new ArrayList<AssociationEntry>(); Iterator it = assoc.getEntries().iterator(); while (it.hasNext()) { AssociationEntry next = (AssociationEntry) it.next(); if (inUse == ALL_ENTRIES) { entries.add(next); } else if (inUse == FREE_ENTRIES) { if (!next.isInUse()) entries.add(next); } else if (inUse == USED_ENTRIES) { if (next.isInUse()) entries.add(next); } } if (entries == null || entries.isEmpty()) return null; return gson.toJson(entries); } catch (WorkspaceDatabaseException e) { throw new RemoteException(e.getMessage()); } }
From source file:org.grouter.core.RouterServerImpl.java
/** * Delegates to scheduler service for stopping a node after looking up a node in db. * * @param nodeId id of node to stop//w ww .j a v a2s. c om * @throws RemoteException if we encounter som exception trying to stop a node */ public void stopNode(String nodeId) throws RemoteException { Node node = routerService.findNodeById(nodeId); logger.info("Stopping node :" + node.getId()); try { schedulerService.stop(node); } catch (Exception e) { throw new RemoteException("Could not stop the node :" + nodeId + " Got exception :" + e.getMessage()); } }
From source file:org.jaggeryjs.integration.common.clients.WebAppAdminClient.java
public void warFileUplaoder(String filePath) throws RemoteException { File file = new File(filePath); String fileName = file.getName(); URL url = null;/*from ww w. j a v a 2 s. c om*/ try { url = new URL("file://" + filePath); } catch (MalformedURLException e) { log.error("Malformed URL " + e); } DataHandler dh = new DataHandler(url); WebappUploadData webApp; webApp = new WebappUploadData(); webApp.setFileName(fileName); webApp.setDataHandler(dh); try { assert webappAdminStub.uploadWebapp(new WebappUploadData[] { webApp }) : "webapp upload unsuccessful"; } catch (RemoteException e) { log.error("Fail to upload webapp file :" + e); throw new RemoteException("Fail to upload webapp file :" + e); } }
From source file:org.jaggeryjs.integration.common.clients.WebAppAdminClient.java
public WebappMetadata getWebAppInfo(String webAppName) throws RemoteException { WebappsWrapper wrapper = getPagedWebappsSummary(webAppName, "ALL", "ALL", 0); VersionedWebappMetadata[] webappGroups = wrapper.getWebapps(); if (webappGroups == null || webappGroups.length == 0) { throw new RemoteException("No Web Application Found with given name " + webAppName); }/*from w w w . j ava 2 s . c om*/ if (webappGroups.length > 1) { // this is happened there are more service available with the given web app name prefix throw new RemoteException("More than one service found with the given name"); } WebappMetadata[] webappMetadatas = webappGroups[0].getVersionGroups(); return webappMetadatas[0]; }
From source file:org.jivesoftware.openfire.crowd.CrowdManager.java
private void handleHTTPError(HttpMethod method) throws RemoteException { int status = method.getStatusCode(); String statusText = method.getStatusText(); String body = null;/*from w w w .ja v a 2 s . c o m*/ try { body = method.getResponseBodyAsString(); } catch (IOException ioe) { LOG.warn("Unable to retreive Crowd http response body", ioe); } StringBuilder strBuf = new StringBuilder(); strBuf.append("Crowd returned HTTP error code:").append(status); strBuf.append(" - ").append(statusText); if (StringUtils.isNotBlank(body)) { strBuf.append("\n").append(body); } throw new RemoteException(strBuf.toString()); }