本文整理汇总了Java中com.vmware.vim25.mo.ScheduledTask类的典型用法代码示例。如果您正苦于以下问题:Java ScheduledTask类的具体用法?Java ScheduledTask怎么用?Java ScheduledTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScheduledTask类属于com.vmware.vim25.mo包,在下文中一共展示了ScheduledTask类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: taskNameExists
import com.vmware.vim25.mo.ScheduledTask; //导入依赖的package包/类
static boolean taskNameExists(ScheduledTaskManager stm,
String vmname)
{
ScheduledTask[] tasks = stm.getScheduledTasks();
boolean found = false;
for(int i=0; tasks!=null && i<tasks.length; i++)
{
if(vmname.equals(tasks[i].getInfo().getName()))
{
found = true;
System.out.println("The task name " + vmname
+ " exists. \nPlease pick a new one.");
break;
}
}
return found;
}
示例2: main
import com.vmware.vim25.mo.ScheduledTask; //导入依赖的package包/类
public static void main(String [] args) throws Exception
{
if(args.length != 4)
{
System.out.println("Usage: java CreateScheduledTasks "
+ "<url> <username> <password> <vmname>");
return;
}
ServiceInstance si = new ServiceInstance(
new URL(args[0]), args[1], args[2], true);
Folder rootFolder = si.getRootFolder();
InventoryNavigator inv = new InventoryNavigator(rootFolder);
String vmname = args[3];
VirtualMachine vm = (VirtualMachine)inv.searchManagedEntity(
"VirtualMachine", vmname);
if(vm==null)
{
System.out.println("Cannot find the VM " + vmname
+ "\nExisting...");
si.getServerConnection().logout();
return;
}
ScheduledTaskManager stm = si.getScheduledTaskManager();
if(stm!=null)
{
//to save space, we just check one name here
if(taskNameExists(stm, "ViMaster_OneTime"))
{
si.getServerConnection().logout();
return;
}
// Note: the time should be fetched from server,
// just to make sure it's synchronized.
ScheduledTaskSpec oneSpec = createOneTimeSchedulerSpec(
"ViMaster_OneTime", si.currentTime());
ScheduledTaskSpec weekSpec = createWeeklySchedulerSpec(
"ViMaster_Weekly");
ScheduledTask st = stm.createScheduledTask(vm, oneSpec);
ScheduledTask st1 = stm.createScheduledTask(vm, weekSpec);
// sleep two minutes before deleting
// the one time scheduled task.
// An one time scheduled task has not to be deleted after
// it's run. It can be run any time again by calling the
// runScheduledTask() method.
Thread.sleep(2*60*1000);
st.removeScheduledTask();
}
else
{
System.out.println("SchduledTaskManager is not "
+ "available on this target.");
}
si.getServerConnection().logout();
}
示例3: createObjectScheduledTask
import com.vmware.vim25.mo.ScheduledTask; //导入依赖的package包/类
/**
* @since SDK4.0
*/
ScheduledTask createObjectScheduledTask(ManagedObject obj, ScheduledTaskSpec spec) throws InvalidName, DuplicateName, RuntimeFault, RemoteException;
示例4: retrieveObjectScheduledTask
import com.vmware.vim25.mo.ScheduledTask; //导入依赖的package包/类
/**
* @since SDK4.0
*/
List<ScheduledTask> retrieveObjectScheduledTask(ManagedObject obj) throws RuntimeFault, RemoteException;
示例5: getScheduledTasks
import com.vmware.vim25.mo.ScheduledTask; //导入依赖的package包/类
List<ScheduledTask> getScheduledTasks();
示例6: createScheduledTask
import com.vmware.vim25.mo.ScheduledTask; //导入依赖的package包/类
ScheduledTask createScheduledTask(ManagedEntity entity, ScheduledTaskSpec spec) throws InvalidName, DuplicateName, RuntimeFault, RemoteException;
示例7: retrieveEntityScheduledTask
import com.vmware.vim25.mo.ScheduledTask; //导入依赖的package包/类
List<ScheduledTask> retrieveEntityScheduledTask(ManagedEntity entity) throws RuntimeFault, RemoteException;