Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added some documentation

  • Loading branch information...
commit eaa592e4cfd509f0344bd34e5423b6c43c7c83f8 1 parent bfe28a1
@rrusnak1 rrusnak1 authored oldpatricka committed
View
3  ...ce-api/java/source/src/org/nimbustools/api/services/admin/RemoteAdminToolsManagement.java
@@ -20,6 +20,9 @@
import java.rmi.Remote;
import java.rmi.RemoteException;
+/**
+ * This interface handles all the work done by RemoteAdminToolsMain and is mapped to the service over rmi
+ */
public interface RemoteAdminToolsManagement extends Remote {
public static final int SHUTDOWN_ALL = 0;
View
4 service/service/java/source/src/org/globus/workspace/remoting/admin/VMTranslation.java
@@ -15,6 +15,9 @@
*/
package org.globus.workspace.remoting.admin;
+/*
+ * String translation class for VMs for sending VM info through rmi
+ */
public class VMTranslation {
private String id;
@@ -27,6 +30,7 @@
private String memory;
private String cpuCount;
+ //Used by Gson
public VMTranslation() {}
public VMTranslation(String id, String node, String groupId, String callerIdentity, String state,
View
22 service/service/java/source/src/org/globus/workspace/remoting/admin/client/AdminEnum.java
@@ -1,12 +1,20 @@
+/*
+ * Copyright 1999-2010 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
package org.globus.workspace.remoting.admin.client;
-/**
- * Created by IntelliJ IDEA.
- * User: rrusnak
- * Date: 6/23/11
- * Time: 11:01 AM
- * To change this template use File | Settings | File Templates.
- */
public interface AdminEnum {
public String option();
public String[] fields();
View
5 ...vice/java/source/src/org/globus/workspace/remoting/admin/client/RemoteAdminToolsMain.java
@@ -27,6 +27,10 @@
import java.util.*;
+/**
+ * This class runs the nimbus-admin tool and connects to the main service over rmi binding
+ * RMI setup and config is handled by parent class RMIConfig
+ */
public class RemoteAdminToolsMain extends RMIConfig {
private static final String PROP_RMI_BINDING_ADMINTOOLS_DIR = "rmi.binding.admintools";
@@ -160,6 +164,7 @@ private void loadArgs(String[] args) throws ParameterProblem {
return;
}
+ //numOpts just makes sure you don't have non-compatible options running at the same time
if(this.action == ToolAction.ListVMs) {
if(line.hasOption(Opts.USER)) {
final String user = line.getOptionValue(Opts.USER);
View
28 .../source/src/org/globus/workspace/remoting/admin/defaults/DefaultRemoteAdminToolsMgmt.java
@@ -41,6 +41,10 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * Remote class that connects service and RemoteAdminToolsMain
+ * Handles DB queries and information requests
+ */
public class DefaultRemoteAdminToolsMgmt implements RemoteAdminToolsManagement {
protected static final Log logger =
@@ -59,9 +63,6 @@ public DefaultRemoteAdminToolsMgmt() {
this.gson = new Gson();
}
- public void initialize() throws Exception {
- }
-
public String getAllRunningVMs() throws RemoteException {
try {
VM[] allRunningVms = manager.getGlobalAll();
@@ -125,6 +126,12 @@ public String getVMsByUser(String user) throws RemoteException {
}
}
+ /*
+ * This class handles shutdown by host, id and all.
+ * The constants for int type are in the interface for this class
+ * typeID is either the id or hostname, depending on if shutting down by id or host, or null if shutting down all
+ * seconds is optional
+ */
public String shutdown(int type, String typeID, String seconds) throws RemoteException {
try {
VM[] vms;
@@ -146,6 +153,10 @@ else if(type == SHUTDOWN_ID)
manager.shutdown(id, manager.INSTANCE, null, caller);
}
+ //checks every 3 seconds to see if one of the vms has entered propagation mode
+ //up to a max of 30 seconds before trashing all vms
+ //I decided against checking every single vm for entering propagation mode since they mostly enter at
+ //about the same speed
if(seconds == null) {
for(int i = 0; i <= 10; i++) {
Thread.sleep(3000);
@@ -160,6 +171,7 @@ else if(type == SHUTDOWN_ID)
break;
}
}
+ //same as above, but max time is the amount of seconds entered by the user
else {
int mill = (Integer.parseInt(seconds)) * 1000;
for(int i = 0; i <= mill; i += 3000) {
@@ -175,6 +187,7 @@ else if(type == SHUTDOWN_ID)
}
}
+ //eventually trashes all vms regardless of whether or not they enter propagation mode
if(type == SHUTDOWN_HOST)
vms = getVMByHost(typeID);
else if(type == SHUTDOWN_ID)
@@ -252,6 +265,9 @@ private String getVMsByUserId(String userId) throws RemoteException {
}
}
+ /*
+ * Looks through all running vms and compares hostnames
+ */
private VM[] getVMByHost(String hostname) throws RemoteException {
try {
VM[] vms;
@@ -281,6 +297,9 @@ private String getVMsByUserId(String userId) throws RemoteException {
}
}
+ /*
+ * Looks through all running vms and compares group ids
+ */
private VM[] getVMByGroup(String groupId) throws RemoteException {
try {
VM[] vms;
@@ -306,6 +325,9 @@ private String getVMsByUserId(String userId) throws RemoteException {
}
}
+ /*
+ * Translates vm info into string format for passing over rmi with Gson
+ */
private VMTranslation translateVM(VM vm) throws RemoteException {
try {
String id = vm.getID();
Please sign in to comment.
Something went wrong with that request. Please try again.