idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
4,300
public void execute ( ) { try { if ( downloadCommandOptions . species != null && ! downloadCommandOptions . species . isEmpty ( ) ) { for ( Species sp : configuration . getAllSpecies ( ) ) { if ( downloadCommandOptions . species . equalsIgnoreCase ( sp . getScientificName ( ) ) || downloadCommandOptions . species . equalsIgnoreCase ( sp . getCommonName ( ) ) || downloadCommandOptions . species . equalsIgnoreCase ( sp . getId ( ) ) ) { species = sp ; break ; } } if ( species != null ) { processSpecies ( species ) ; } else { logger . error ( "Species '{}' not valid" , downloadCommandOptions . species ) ; } } else { logger . error ( "--species parameter '{}' not valid" , downloadCommandOptions . species ) ; } } catch ( ParameterException e ) { logger . error ( "Error in 'download' command line: " + e . getMessage ( ) ) ; } catch ( IOException | InterruptedException e ) { logger . error ( "Error downloading '" + downloadCommandOptions . species + "' files: " + e . getMessage ( ) ) ; } }
Execute specific download command options .
4,301
private void downloadProtein ( ) throws IOException , InterruptedException { logger . info ( "Downloading protein information ..." ) ; Path proteinFolder = common . resolve ( "protein" ) ; if ( ! Files . exists ( proteinFolder ) ) { makeDir ( proteinFolder ) ; String url = configuration . getDownload ( ) . getUniprot ( ) . getHost ( ) ; downloadFile ( url , proteinFolder . resolve ( "uniprot_sprot.xml.gz" ) . toString ( ) ) ; String relNotesUrl = configuration . getDownload ( ) . getUniprotRelNotes ( ) . getHost ( ) ; downloadFile ( relNotesUrl , proteinFolder . resolve ( "uniprotRelnotes.txt" ) . toString ( ) ) ; saveVersionData ( EtlCommons . PROTEIN_DATA , UNIPROT_NAME , getLine ( proteinFolder . resolve ( "uniprotRelnotes.txt" ) , 1 ) , getTimeStamp ( ) , Collections . singletonList ( url ) , proteinFolder . resolve ( "uniprotVersion.json" ) ) ; makeDir ( proteinFolder . resolve ( "uniprot_chunks" ) ) ; splitUniprot ( proteinFolder . resolve ( "uniprot_sprot.xml.gz" ) , proteinFolder . resolve ( "uniprot_chunks" ) ) ; url = configuration . getDownload ( ) . getIntact ( ) . getHost ( ) ; downloadFile ( url , proteinFolder . resolve ( "intact.txt" ) . toString ( ) ) ; saveVersionData ( EtlCommons . PROTEIN_DATA , INTACT_NAME , null , getTimeStamp ( ) , Collections . singletonList ( url ) , proteinFolder . resolve ( "intactVersion.json" ) ) ; url = configuration . getDownload ( ) . getInterpro ( ) . getHost ( ) ; downloadFile ( url , proteinFolder . resolve ( "protein2ipr.dat.gz" ) . toString ( ) ) ; relNotesUrl = configuration . getDownload ( ) . getInterproRelNotes ( ) . getHost ( ) ; downloadFile ( relNotesUrl , proteinFolder . resolve ( "interproRelnotes.txt" ) . toString ( ) ) ; saveVersionData ( EtlCommons . PROTEIN_DATA , INTERPRO_NAME , getLine ( proteinFolder . resolve ( "interproRelnotes.txt" ) , 5 ) , getTimeStamp ( ) , Collections . singletonList ( url ) , proteinFolder . resolve ( "interproVersion.json" ) ) ; } else { logger . info ( "Protein: skipping this since it is already downloaded. Delete 'protein' folder to force download" ) ; } }
This method downloads UniProt IntAct and Interpro data from EMBL - EBI .
4,302
public static float buildFloat ( int mant , int exp ) { if ( exp < - 125 || mant == 0 ) { return 0.0f ; } if ( exp >= 128 ) { return ( mant > 0 ) ? Float . POSITIVE_INFINITY : Float . NEGATIVE_INFINITY ; } if ( exp == 0 ) { return mant ; } if ( mant >= ( 1 << 26 ) ) { mant ++ ; } return ( float ) ( ( exp > 0 ) ? mant * pow10 [ exp ] : mant / pow10 [ - exp ] ) ; }
Computes a float from mantissa and exponent .
4,303
public SVGBuilder readFromAsset ( AssetManager assetMngr , String svgPath ) throws IOException { this . data = assetMngr . open ( svgPath ) ; return this ; }
Parse SVG data from an Android application asset .
4,304
public SVGBuilder setColorSwap ( int searchColor , int replaceColor , boolean overideOpacity ) { this . searchColor = searchColor ; this . replaceColor = replaceColor ; this . overideOpacity = overideOpacity ; return this ; }
Replaces a single colour with another affecting the opacity .
4,305
public Task evacuateVsanNode_Task ( HostMaintenanceSpec maintenanceSpec , int timeout ) throws InvalidState , RequestCanceled , RuntimeFault , Timedout , VsanFault , RemoteException { return new Task ( getServerConnection ( ) , getVimService ( ) . evacuateVsanNode_Task ( getMOR ( ) , maintenanceSpec , timeout ) ) ; }
Evacuate this host from VSAN cluster . The task is cancellable .
4,306
public Task recommissionVsanNode_Task ( ) throws InvalidState , RuntimeFault , VsanFault , RemoteException { return new Task ( getServerConnection ( ) , getVimService ( ) . recommissionVsanNode_Task ( getMOR ( ) ) ) ; }
Recommission this host to VSAN cluster . Users may use this API to recommission a node that has been evacuated in VsanHostDecommissionMode .
4,307
public Task unmountDiskMapping_Task ( VsanHostDiskMapping [ ] mapping ) throws InvalidState , RuntimeFault , VsanFault , RemoteException { return new Task ( getServerConnection ( ) , getVimService ( ) . unmountDiskMapping_Task ( getMOR ( ) , mapping ) ) ; }
Unmount the mounted DiskMapping . An unmounted volume cannot be used for any VSAN operations . In contrast to RemoveDiskMapping_Task this operation does not destroy or alter VSAN data on the disks . AddDisks_Task and InitializeDisks_Task can be used to re - mount the diskMapping .
4,308
public void installServerCertificate ( String cert ) throws HostConfigFault , RuntimeFault , RemoteException { getVimService ( ) . installServerCertificate ( getMOR ( ) , cert ) ; }
Installs a given SSL certificate on the server .
4,309
public Task enterMaintenanceMode ( int timeout , boolean evacuatePoweredOffVms ) throws Timedout , InvalidState , RuntimeFault , RemoteException { return enterMaintenanceMode ( timeout , evacuatePoweredOffVms , null ) ; }
keep the old signature for compatibility
4,310
public void printAllExtensions ( ) { Extension [ ] exts = getExtensionList ( ) ; System . out . println ( "There are totally " + exts . length + " plugin(s) registered." ) ; for ( int i = 0 ; i < exts . length ; i ++ ) { System . out . println ( "\n ---- Plugin # " + ( i + 1 ) + " ---- " ) ; System . out . println ( "Key: " + exts [ i ] . getKey ( ) ) ; System . out . println ( "Version: " + exts [ i ] . getVersion ( ) ) ; System . out . println ( "Registration Time: " + exts [ i ] . getLastHeartbeatTime ( ) . getTime ( ) ) ; System . out . println ( "Configuration URL: " + exts [ i ] . getServer ( ) [ 0 ] . getUrl ( ) ) ; } }
Print out information of all the plugins to stdout
4,311
private void validateDVPortGroupForVNicConnection ( DistributedVirtualPortgroupInfo dvPortgroupInfo ) { if ( dvPortgroupInfo . uplinkPortgroup ) { throw new RuntimeException ( "The vDS portgroup's uplinkPortgroup should not be null" ) ; } DistributedVirtualPortgroupPortgroupType portgroupType = DistributedVirtualPortgroupPortgroupType . valueOf ( dvPortgroupInfo . portgroupType ) ; String prodLineId = vm . getServerConnection ( ) . getServiceInstance ( ) . getAboutInfo ( ) . getProductLineId ( ) ; if ( prodLineId . indexOf ( "ESX" ) != - 1 && ( portgroupType == DistributedVirtualPortgroupPortgroupType . earlyBinding || portgroupType == DistributedVirtualPortgroupPortgroupType . lateBinding ) ) { throw new RuntimeException ( "ESX does not support early or late binding!" ) ; } }
Validate if vDS Portgroup can be bound to vnic
4,312
private static VirtualNetworkAdapterType validateNicType ( GuestOsDescriptor [ ] guestOsDescriptorList , String guestId , VirtualNetworkAdapterType adapterType ) throws DeviceNotSupported { VirtualNetworkAdapterType result = adapterType ; GuestOsDescriptor guestOsInfo = null ; for ( GuestOsDescriptor desc : guestOsDescriptorList ) { if ( desc . getId ( ) . equalsIgnoreCase ( guestId ) ) { guestOsInfo = desc ; break ; } } if ( adapterType == VirtualNetworkAdapterType . Unknown ) { result = TryGetNetworkAdapterType ( guestOsInfo ) ; } else { if ( guestOsInfo . getSupportedEthernetCard ( ) != null ) { boolean supported = false ; List < String > supportedTypeList = new ArrayList < String > ( ) ; for ( String supportedAdapterName : guestOsInfo . getSupportedEthernetCard ( ) ) { VirtualNetworkAdapterType supportedAdapterType = GetNetworkAdapterTypeByApiType ( supportedAdapterName ) ; supportedTypeList . add ( supportedAdapterType . toString ( ) ) ; if ( supportedAdapterType == adapterType ) { supported = true ; break ; } } if ( ! supported ) { DeviceNotSupported dns = new DeviceNotSupported ( ) ; dns . setDevice ( "Virtual NIC" ) ; dns . setReason ( "The requested NIC is not supported in this OS." ) ; throw dns ; } } } return result ; }
Check network adapter type if it s supported by the guest OS
4,313
private static VirtualNetworkAdapterType TryGetNetworkAdapterType ( GuestOsDescriptor guestOsInfo ) { String ethernetCardType = guestOsInfo . getRecommendedEthernetCard ( ) ; if ( ( ethernetCardType == null || ethernetCardType . isEmpty ( ) ) && ( guestOsInfo . getSupportedEthernetCard ( ) != null ) && ( ( guestOsInfo . getSupportedEthernetCard ( ) . length > 0 ) ) ) { ethernetCardType = guestOsInfo . getSupportedEthernetCard ( ) [ 0 ] ; } return GetNetworkAdapterTypeByApiType ( ethernetCardType ) ; }
Returns VirtualEthernetCard type recommended for the selected GuestOs
4,314
public Task removeDevice ( VirtualDevice device , boolean destroyDeviceBacking ) throws InvalidName , VmConfigFault , DuplicateName , TaskInProgress , FileFault , InvalidState , ConcurrentAccess , InvalidDatastore , InsufficientResourcesFault , RuntimeFault , RemoteException { ArrayList < VirtualDevice > deviceList = new ArrayList < VirtualDevice > ( ) ; deviceList . add ( device ) ; return removeDevices ( deviceList , destroyDeviceBacking ) ; }
Remove the device . Make sure the VM is powered off before calling this method . If destroyDeviceBacking is true it deletes backings for example files in datastore . BE CAREFUL!
4,315
public Task removeDevices ( List < VirtualDevice > deviceList , boolean destroyDeviceBacking ) throws InvalidName , VmConfigFault , DuplicateName , TaskInProgress , FileFault , InvalidState , ConcurrentAccess , InvalidDatastore , InsufficientResourcesFault , RuntimeFault , RemoteException { List < VirtualDeviceConfigSpec > configSpecList = new ArrayList < VirtualDeviceConfigSpec > ( ) ; boolean allDevicesSupportHotRemoval = allSupportHotRemoval ( deviceList ) ; VirtualMachinePowerState powerState = vm . getRuntime ( ) . getPowerState ( ) ; if ( ! allDevicesSupportHotRemoval && powerState != VirtualMachinePowerState . poweredOff ) { throw new RuntimeException ( "Invalid power state: power off the VM first." ) ; } for ( VirtualDevice device : deviceList ) { try { if ( device instanceof VirtualDisk && powerState == VirtualMachinePowerState . poweredOff ) { List < VirtualSCSIController > contollerList = getVirtualDevicesOfType ( VirtualSCSIController . class ) ; for ( VirtualSCSIController controller : contollerList ) { if ( controller . key == device . controllerKey ) { if ( controller . device . length == 1 && controller . device [ 0 ] == device . key ) { VirtualDeviceConfigSpec controllerSpec = new VirtualDeviceConfigSpec ( ) ; controllerSpec . operation = VirtualDeviceConfigSpecOperation . remove ; controllerSpec . device = controller ; configSpecList . add ( controllerSpec ) ; } break ; } } } if ( device instanceof VirtualUSB ) { List < VirtualUSBController > contollerList = getVirtualDevicesOfType ( VirtualUSBController . class ) ; for ( VirtualUSBController controller : contollerList ) { if ( controller . key == device . controllerKey ) { if ( controller . device . length == 1 && controller . device [ 0 ] == device . key ) { VirtualDeviceConfigSpec controllerSpec = new VirtualDeviceConfigSpec ( ) ; controllerSpec . operation = VirtualDeviceConfigSpecOperation . remove ; controllerSpec . device = controller ; configSpecList . add ( controllerSpec ) ; } break ; } } continue ; } VirtualDeviceConfigSpec deviceSpec = new VirtualDeviceConfigSpec ( ) ; deviceSpec . operation = VirtualDeviceConfigSpecOperation . remove ; deviceSpec . device = device ; if ( destroyDeviceBacking ) { deviceSpec . fileOperation = VirtualDeviceConfigSpecFileOperation . destroy ; } configSpecList . add ( deviceSpec ) ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } } if ( configSpecList . size ( ) > 0 ) { VirtualMachineConfigSpec config = new VirtualMachineConfigSpec ( ) ; config . deviceChange = new VirtualDeviceConfigSpec [ configSpecList . size ( ) ] ; for ( int i = 0 ; i < configSpecList . size ( ) ; i ++ ) { config . deviceChange [ i ] = configSpecList . get ( i ) ; } return vm . reconfigVM_Task ( config ) ; } return null ; }
Remove all devices as listed in the deviceList . These devices can be different types . Make sure the VM is powered off before calling this method . If destroyDeviceBacking is true it deletes backings for example files in datastore . BE CAREFUL!
4,316
public static String getXSIType ( Object obj ) { Class < ? > type = obj . getClass ( ) ; for ( int i = 0 ; i < clazzes . length ; i ++ ) { if ( type == clazzes [ i ] ) { return xsdStrs [ i ] ; } } if ( obj instanceof java . util . Calendar ) { return "xsd:dateTime" ; } throw new RuntimeException ( "Unknown data type during serialization:" + type ) ; }
only for the basic data types as shown above
4,317
public Task attachScsiLunEx_Task ( String [ ] lunUuid ) throws HostConfigFault , RuntimeFault , RemoteException { ManagedObjectReference taskMor = getVimService ( ) . attachScsiLunEx_Task ( getMOR ( ) , lunUuid ) ; return new Task ( getServerConnection ( ) , taskMor ) ; }
Attach one or more SCSI LUNs . This is an asynchronous batch operation of attachScisLun .
4,318
public void changeNFSUserPassword ( String password ) throws HostConfigFault , NotFound , RuntimeFault , RemoteException { getVimService ( ) . changeNFSUserPassword ( getMOR ( ) , password ) ; }
Change password for existing NFS user . This method shall be called after the NFS user has been created on the host .
4,319
public Task markAsLocal_Task ( String scsiDiskUuid ) throws HostConfigFault , NotFound , RuntimeFault , RemoteException { ManagedObjectReference taskMor = getVimService ( ) . markAsLocal_Task ( getMOR ( ) , scsiDiskUuid ) ; return new Task ( getServerConnection ( ) , taskMor ) ; }
Mark a disk to local disk due to the reason that local disks behind some controllers might not be recognized as local correctly . Task failure might lose existing claim rules on the disk .
4,320
public Task mountVmfsVolumeEx_Task ( String [ ] vmfsUuid ) throws HostConfigFault , RuntimeFault , RemoteException { ManagedObjectReference taskMor = getVimService ( ) . mountVmfsVolumeEx_Task ( getMOR ( ) , vmfsUuid ) ; return new Task ( getServerConnection ( ) , taskMor ) ; }
Mount one or more VMFS volumes . This is an asynchronous batch operation of mountVmfsVolume .
4,321
public Task checkAddHostEvc_Task ( HostConnectSpec hostConnectSpec ) throws GatewayConnectFault , HostConnectFault , InvalidLogin , RuntimeFault , RemoteException { ManagedObjectReference task = getVimService ( ) . checkAddHostEvc_Task ( getMOR ( ) , hostConnectSpec ) ; return new Task ( getServerConnection ( ) , task ) ; }
Test the validity of adding a host into the managed cluster . Note that this method only tests EVC admission control ; host - add may fail for other reasons .
4,322
public Task checkConfigureEvcMode_Task ( String evcModeKey ) throws RuntimeFault , RemoteException { ManagedObjectReference task = getVimService ( ) . checkConfigureEvcMode_Task ( getMOR ( ) , evcModeKey ) ; return new Task ( getServerConnection ( ) , task ) ; }
Test the validity of configuring an EVC mode on the managed cluster .
4,323
public Task configureEvcMode_Task ( String evcModeKey ) throws RuntimeFault , RemoteException , EVCConfigFault { ManagedObjectReference task = getVimService ( ) . configureEvcMode_Task ( getMOR ( ) , evcModeKey ) ; return new Task ( getServerConnection ( ) , task ) ; }
Set the EVC mode . If EVC is currently disabled then this will enable EVC . The parameter must specify a key to one of the EVC modes listed in the supportedEVCMode array property . If there are no modes listed there then EVC may not currently be enabled ; reference the other properties in EVCState to determine what conditions are blocking EVC .
4,324
public Task disableEvcMode_Task ( ) throws RuntimeFault , RemoteException { ManagedObjectReference task = getVimService ( ) . disableEvcMode_Task ( getMOR ( ) ) ; return new Task ( getServerConnection ( ) , task ) ; }
Disable EVC . EVC may be disabled at any time .
4,325
public void acknowledgeAlarm ( Alarm alarm , ManagedEntity entity ) throws RuntimeFault , RemoteException { getVimService ( ) . acknowledgeAlarm ( getMOR ( ) , alarm . getMOR ( ) , entity . getMOR ( ) ) ; }
Acknowledge the alarm for a managed entity .
4,326
public void setAlarmStatus ( Alarm alarm , ManagedEntity entity , String status ) throws RuntimeFault , RemoteException { getVimService ( ) . setAlarmStatus ( getMOR ( ) , alarm . getMOR ( ) , entity . getMOR ( ) , status ) ; }
Set the status of an alarm for the given managed entity . Not a public VMware API .
4,327
public boolean areAlarmActionsEnabled ( ManagedEntity entity ) throws RuntimeFault , RemoteException { return getVimService ( ) . areAlarmActionsEnabled ( getMOR ( ) , entity . getMOR ( ) ) ; }
Whether or not alarm actions are available on the given ManagedEntity
4,328
public void enableAlarmActions ( ManagedEntity entity , boolean enabled ) throws RuntimeFault , RemoteException { getVimService ( ) . enableAlarmActions ( getMOR ( ) , entity . getMOR ( ) , enabled ) ; }
Toggles alarms on the given managed entity .
4,329
public Alarm createAlarm ( ManagedEntity me , AlarmSpec as ) throws InvalidName , DuplicateName , RuntimeFault , RemoteException { if ( me == null ) { throw new IllegalArgumentException ( "entity must not be null." ) ; } ManagedObjectReference mor = getVimService ( ) . createAlarm ( getMOR ( ) , me . getMOR ( ) , as ) ; return new Alarm ( getServerConnection ( ) , mor ) ; }
Create an alarm against the given managed entity using the alarm specification
4,330
private void collectScsiRuntimeNames ( ) { ArrayList < ScsiLun > sortedScsiLuns = new ArrayList < ScsiLun > ( ) ; if ( storageDeviceInfo . getScsiLun ( ) . length == 0 ) { log . trace ( "There are no Scsi LUNS on this storage device." ) ; return ; } for ( ScsiLun lun : storageDeviceInfo . getScsiLun ( ) ) { if ( lun . lunType . equals ( "disk" ) ) { sortedScsiLuns . add ( lun ) ; } } ArrayList < Map > scsiTopologyInfo = new ArrayList < Map > ( ) ; HostScsiTopology scsiTopology = storageDeviceInfo . scsiTopology ; if ( null == scsiTopology . adapter || scsiTopology . adapter . length == 0 ) { log . trace ( "There are no adapters on this storage device." ) ; return ; } for ( HostScsiTopologyInterface adapter : scsiTopology . adapter ) { if ( null == adapter . target || adapter . target . length == 0 ) { log . trace ( "This adapter has no targets. Adapter:" + adapter . adapter ) ; continue ; } for ( HostScsiTopologyTarget target : adapter . target ) { if ( null == target . lun || target . lun . length == 0 ) { log . trace ( "This target has no LUNs on it. Target:" + target . key ) ; continue ; } for ( HostScsiTopologyLun lun : target . lun ) { Map < String , Object > scsiInfo = new HashMap < String , Object > ( ) ; scsiInfo . put ( "key" , target . key ) ; scsiInfo . put ( "lunInfo" , lun ) ; scsiTopologyInfo . add ( scsiInfo ) ; } } } if ( sortedScsiLuns . size ( ) == 0 || scsiTopologyInfo . size ( ) == 0 ) { log . trace ( "There is no SCSI Lun information on this host" ) ; return ; } for ( ScsiLun lun : sortedScsiLuns ) { for ( Map info : scsiTopologyInfo ) { HostScsiTopologyLun scsiTopologyLun = ( HostScsiTopologyLun ) info . get ( "lunInfo" ) ; if ( scsiTopologyLun . scsiLun . equals ( lun . key ) ) { String [ ] names = info . get ( "key" ) . toString ( ) . split ( "-" ) ; String name = names [ names . length - 1 ] ; String [ ] nameSplit = name . split ( ":" ) ; this . scsiRuntimeNames . put ( lun . key , ( nameSplit [ 0 ] + ":C" + nameSplit [ 1 ] + ":T" + nameSplit [ 2 ] + ":L" + scsiTopologyLun . getLun ( ) ) ) ; } } } }
Collects Runtime names for all ScsiLuns on a Host where the ScsiLun type is disk .
4,331
public Task addHost_Task ( HostConnectSpec spec , boolean asConnected , ResourcePool resourcePool ) throws InvalidLogin , HostConnectFault , RuntimeFault , RemoteException { return addHost_Task ( spec , asConnected , resourcePool , null ) ; }
SDK 2 . 5 signature for back compatibility
4,332
public Task addHost_Task ( HostConnectSpec spec , boolean asConnected , ResourcePool resourcePool , String license ) throws InvalidLogin , HostConnectFault , RuntimeFault , RemoteException { ManagedObjectReference taskMOR = getVimService ( ) . addHost_Task ( getMOR ( ) , spec , asConnected , resourcePool == null ? null : resourcePool . getMOR ( ) , license ) ; return new Task ( getServerConnection ( ) , taskMOR ) ; }
new SDK 4 . 0 signature
4,333
public ClusterEVCManager evcManager ( ) throws RuntimeFault , RemoteException { ManagedObjectReference cevcmgrMor = getVimService ( ) . evcManager ( getMOR ( ) ) ; return new ClusterEVCManager ( getServerConnection ( ) , cevcmgrMor ) ; }
Returns A managed object that controls Enhanced vMotion Compatibility mode for this cluster .
4,334
public ClusterRuleInfo [ ] findRulesForVm ( VirtualMachine vm ) throws RuntimeFault , RemoteException { return getVimService ( ) . findRulesForVm ( getMOR ( ) , vm . getMOR ( ) ) ; }
Finds all enabled and disabled VM - VM Affinity and Anti - Affinity rules involving the given Virtual Machine .
4,335
public PlacementResult placeVm ( PlacementSpec placementSpec ) throws InvalidArgument , InvalidState , RuntimeFault , RemoteException { return getVimService ( ) . placeVm ( getMOR ( ) , placementSpec ) ; }
This method returns a PlacementResult object . This API can be invoked to ask DRS for a set of recommendations for moving a virtual machine and its virtual disks into a cluster .
4,336
public Task stampAllRulesWithUuid_Task ( ) throws RuntimeFault , RemoteException { ManagedObjectReference taskMor = getVimService ( ) . stampAllRulesWithUuid_Task ( getMOR ( ) ) ; return new Task ( getServerConnection ( ) , taskMor ) ; }
Stamp all rules in the cluster with ruleUuid . If a rule has ruleUuid field set and it has a value leave it untouched . If rule s ruleUuid field is unset generate a UUID and stamp the rule .
4,337
public static ManagedObjectReference createMOR ( String type , String value ) { return MorUtil . createMOR ( type , value ) ; }
Switch usage of this to the MorUtil
4,338
public Task moveVirtualDisk_Task ( String sourceName , Datacenter sourceDatacenter , String destName , Datacenter destDatacenter , Boolean force ) throws FileFault , RuntimeFault , RemoteException { return moveVirtualDisk_Task ( sourceName , sourceDatacenter , destName , destDatacenter , force , null ) ; }
keep the old signature for compability
4,339
public static ManagedObjectReference [ ] createMORs ( ManagedObject [ ] mos ) { if ( mos == null ) { throw new IllegalArgumentException ( ) ; } ManagedObjectReference [ ] mors = new ManagedObjectReference [ mos . length ] ; for ( int i = 0 ; i < mos . length ; i ++ ) { mors [ i ] = mos [ i ] . getMOR ( ) ; } return mors ; }
Takes an array of ManagedObjects and returns the MOR for each MO
4,340
public static ManagedObject createExactManagedObject ( ServerConnection sc , ManagedObjectReference mor ) { if ( mor == null ) { return null ; } String moType = mor . getType ( ) ; Class moClass = null ; try { moClass = Class . forName ( moPackageName + "." + moType ) ; Constructor constructor = moClass . getConstructor ( new Class [ ] { ServerConnection . class , ManagedObjectReference . class } ) ; return ( ManagedObject ) constructor . newInstance ( new Object [ ] { sc , mor } ) ; } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException ( "vijava does not have an associated class for this mor: " + mor . getVal ( ) , e ) ; } catch ( NoSuchMethodException e ) { throw new IllegalArgumentException ( "No constructor found in vijava for class: " + moClass . getName ( ) , e ) ; } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "vijava is unable to create a managed object from this mor: " + mor . getVal ( ) , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "vijava is unable to create a managed object from this mor: " + mor . getVal ( ) , e ) ; } catch ( InvocationTargetException e ) { throw new IllegalArgumentException ( "vijava is unable to create a managed object from this mor: " + mor . getVal ( ) , e ) ; } }
Given the ServerConnection and a MOR return the MO
4,341
public static ManagedEntity createExactManagedEntity ( ServerConnection sc , ManagedObjectReference mor ) { return ( ManagedEntity ) createExactManagedObject ( sc , mor ) ; }
Given a ServerConnection and a MOR return the ME
4,342
public static ManagedEntity [ ] createManagedEntities ( ServerConnection sc , ManagedObjectReference [ ] mors ) { if ( mors == null ) { return new ManagedEntity [ 0 ] ; } ManagedEntity [ ] mes = new ManagedEntity [ mors . length ] ; for ( int i = 0 ; i < mors . length ; i ++ ) { mes [ i ] = createExactManagedEntity ( sc , mors [ i ] ) ; } return mes ; }
Given a ServerConnection and an array of MORs return an array of MEs
4,343
public static Field [ ] getAllFields ( Class < ? > c ) { List < Field > listOfFields = new ArrayList < Field > ( ) ; getAllFields ( c , listOfFields ) ; Field [ ] arrayOffields = new Field [ listOfFields . size ( ) ] ; listOfFields . toArray ( arrayOffields ) ; return arrayOffields ; }
Given any class return an Array of Fields in the class
4,344
public static Hashtable [ ] retrieveProperties ( ManagedObject [ ] mos , String moType , String [ ] propPaths ) throws InvalidProperty , RuntimeFault , RemoteException { if ( mos == null ) { throw new IllegalArgumentException ( "Managed object array cannot be null." ) ; } if ( mos . length == 0 || mos [ 0 ] == null ) { return new Hashtable [ ] { } ; } PropertyCollector pc = getPropertyCollector ( mos [ 0 ] ) ; ObjectSpec [ ] oss = new ObjectSpec [ mos . length ] ; for ( int i = 0 ; i < oss . length ; i ++ ) { oss [ i ] = new ObjectSpec ( ) ; oss [ i ] . setObj ( mos [ i ] . getMOR ( ) ) ; } PropertySpec pSpec = createPropertySpec ( moType , false , propPaths ) ; PropertyFilterSpec pfs = new PropertyFilterSpec ( ) ; pfs . setObjectSet ( oss ) ; pfs . setPropSet ( new PropertySpec [ ] { pSpec } ) ; ObjectContent [ ] objs = pc . retrieveProperties ( new PropertyFilterSpec [ ] { pfs } ) ; Hashtable [ ] pTables = new Hashtable [ mos . length ] ; for ( int i = 0 ; objs != null && i < objs . length && objs [ i ] != null ; i ++ ) { DynamicProperty [ ] props = objs [ i ] . getPropSet ( ) ; ManagedObjectReference mor = objs [ i ] . getObj ( ) ; int index ; if ( mor . getType ( ) . equals ( mos [ i ] . getMOR ( ) . getType ( ) ) && mor . get_value ( ) . equals ( mos [ i ] . getMOR ( ) . get_value ( ) ) ) { index = i ; } else { index = findIndex ( mos , mor ) ; if ( index == - 1 ) { throw new RuntimeException ( "Unexpected managed object in result: " + mor . getType ( ) + ":" + mor . get_value ( ) ) ; } } pTables [ index ] = new Hashtable ( ) ; for ( int j = 0 ; props != null && j < props . length ; j ++ ) { Object obj = convertProperty ( props [ j ] . getVal ( ) ) ; if ( obj == null ) { obj = NULL ; } pTables [ index ] . put ( props [ j ] . getName ( ) , obj ) ; } } return pTables ; }
Retrieves properties from multiple managed objects .
4,345
private static List < TraversalSpec > buildFullTraversalV2NoFolder ( ) { TraversalSpec rpToRp = createTraversalSpec ( "rpToRp" , "ResourcePool" , "resourcePool" , new String [ ] { "rpToRp" , "rpToVm" } ) ; TraversalSpec rpToVm = createTraversalSpec ( "rpToVm" , "ResourcePool" , "vm" , new SelectionSpec [ ] { } ) ; TraversalSpec crToRp = createTraversalSpec ( "crToRp" , "ComputeResource" , "resourcePool" , new String [ ] { "rpToRp" , "rpToVm" } ) ; TraversalSpec crToH = createTraversalSpec ( "crToH" , "ComputeResource" , "host" , new SelectionSpec [ ] { } ) ; TraversalSpec dcToHf = createTraversalSpec ( "dcToHf" , "Datacenter" , "hostFolder" , new String [ ] { "visitFolders" } ) ; TraversalSpec dcToVmf = createTraversalSpec ( "dcToVmf" , "Datacenter" , "vmFolder" , new String [ ] { "visitFolders" } ) ; TraversalSpec HToVm = createTraversalSpec ( "HToVm" , "HostSystem" , "vm" , new String [ ] { "visitFolders" } ) ; return Arrays . asList ( dcToVmf , dcToHf , crToH , crToRp , rpToRp , HToVm , rpToVm ) ; }
This method creates basic set of TraveralSpec without visitFolders spec
4,346
public Hashtable getPropertiesByPaths ( String [ ] propPaths ) throws InvalidProperty , RuntimeFault , RemoteException { Hashtable [ ] pht = PropertyCollectorUtil . retrieveProperties ( new ManagedObject [ ] { this } , getMOR ( ) . getType ( ) , propPaths ) ; if ( pht . length != 0 ) { return pht [ 0 ] ; } else { return null ; } }
Get multiple properties by their paths
4,347
public HostVsanInternalSystemVsanPhysicalDiskDiagnosticsResult [ ] runVsanPhysicalDiskDiagnostics ( String [ ] disks ) throws RuntimeFault , RemoteException { return getVimService ( ) . runVsanPhysicalDiskDiagnostics ( getMOR ( ) , disks ) ; }
Runs diagnostics on VSAN physical disks . This method takes an active approach and creates a minimal and temporary object on each physical MD disk consumed by VSAN across the entire VSAN cluster . The temporary objects are deleted right away upon completion of creation . The result returns a list of all checked MDs indicating wheather or not there was a problem creating an object on that MD at the given point in time .
4,348
public String marshall ( String methodName , Argument [ ] paras ) { String soapMsg = XmlGen . toXML ( methodName , paras , vimNameSpace ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "Marshalled Payload String xml: " + soapMsg ) ; } return soapMsg ; }
This method will marshall the java payload object in to xml payload .
4,349
public Object unMarshall ( String returnType , InputStream is ) throws Exception { return xmlGen . fromXML ( returnType , is ) ; }
This method will unmarshall the response inputstream to Java Object of returnType type .
4,350
public GuestMappedAliases [ ] listGuestMappedAliases ( VirtualMachine vm , GuestAuthentication auth ) throws GuestComponentsOutOfDate , GuestOperationsFault , GuestOperationsUnavailable , GuestPermissionDenied , InvalidGuestLogin , InvalidPowerState , InvalidState , OperationDisabledByGuest , OperationNotSupportedByGuest , RuntimeFault , TaskInProgress , RemoteException { return getVimService ( ) . listGuestMappedAliases ( getMOR ( ) , vm . getMOR ( ) , auth ) ; }
Lists the GuestMappedAliases in the guest that can be used for authentication of guest operations .
4,351
public ManagedEntity [ ] searchManagedEntities ( boolean recurse ) throws InvalidProperty , RuntimeFault , RemoteException { String [ ] [ ] typeinfo = new String [ ] [ ] { new String [ ] { "ManagedEntity" , } } ; return searchManagedEntities ( typeinfo , recurse ) ; }
Retrieve container contents from specified parent recursively if requested .
4,352
public ManagedEntity [ ] searchManagedEntities ( String type ) throws InvalidProperty , RuntimeFault , RemoteException { String [ ] [ ] typeinfo = new String [ ] [ ] { new String [ ] { type , "name" , } , } ; return searchManagedEntities ( typeinfo , true ) ; }
Get the first ManagedObjectReference from current node for the specified type
4,353
public ManagedEntity [ ] searchManagedEntities ( String [ ] [ ] typeinfo , boolean recurse ) throws InvalidProperty , RuntimeFault , RemoteException { ObjectContent [ ] ocs = retrieveObjectContents ( typeinfo , recurse ) ; return createManagedEntities ( ocs ) ; }
Retrieve content recursively with multiple properties . the typeinfo array contains typename + properties to retrieve .
4,354
public ManagedEntity searchManagedEntity ( String type , String name ) throws InvalidProperty , RuntimeFault , RemoteException { if ( name == null || name . length ( ) == 0 ) { return null ; } if ( type == null ) { type = "ManagedEntity" ; } String [ ] [ ] typeinfo = new String [ ] [ ] { new String [ ] { type , "name" , } , } ; ObjectContent [ ] ocs = retrieveObjectContents ( typeinfo , true ) ; if ( ocs == null || ocs . length == 0 ) { return null ; } for ( int i = 0 ; i < ocs . length ; i ++ ) { DynamicProperty [ ] propSet = ocs [ i ] . getPropSet ( ) ; if ( propSet . length > 0 ) { String nameInPropSet = ( String ) propSet [ 0 ] . getVal ( ) ; if ( name . equalsIgnoreCase ( nameInPropSet ) ) { ManagedObjectReference mor = ocs [ i ] . getObj ( ) ; return MorUtil . createExactManagedEntity ( rootEntity . getServerConnection ( ) , mor ) ; } } } return null ; }
Get the ManagedObjectReference for an item under the specified parent node that has the type and name specified .
4,355
public LocalizedMethodFault [ ] queryFaultToleranceCompatibilityEx ( Boolean forLegacyFt ) throws InvalidState , VmConfigFault , RuntimeFault , RemoteException { return getVimService ( ) . queryFaultToleranceCompatibilityEx ( getMOR ( ) , forLegacyFt ) ; }
This API can be invoked to determine whether a virtual machine is compatible for Fault Tolerance . The API only checks for VM - specific factors that impact compatibility for Fault Tolerance . Other requirements for Fault Tolerance such as host processor compatibility logging nic configuration and licensing are not covered by this API . The query returns a list of faults each fault corresponding to a specific incompatibility . If a given virtual machine is compatible for Fault Tolerance then the fault list returned will be empty .
4,356
public Task installIoFilter_Task ( String vibUrl , ComputeResource compRes ) throws AlreadyExists , InvalidArgument , RuntimeFault , RemoteException { return new Task ( getServerConnection ( ) , getVimService ( ) . installIoFilter_Task ( getMOR ( ) , vibUrl , compRes . getMOR ( ) ) ) ; }
Install an IO Filter on a compute resource . IO Filters can only be installed on a cluster .
4,357
public VirtualDiskId [ ] queryDisksUsingFilter ( String filterId , ComputeResource compRes ) throws RemoteException , RuntimeFault { return getVimService ( ) . queryDisksUsingFilter ( getMOR ( ) , filterId , compRes . getMOR ( ) ) ; }
Queries and return the list of virtual disks that use an IO Filter installed on a compute resource .
4,358
public ClusterIoFilterInfo [ ] queryIoFilterInfo ( ComputeResource compRes ) throws RemoteException , RuntimeFault { return getVimService ( ) . queryIoFilterInfo ( getMOR ( ) , compRes . getMOR ( ) ) ; }
Queries and return the information for the IO Filters that are installed on the cluster .
4,359
public Task unInstallIoFilter_Task ( String filterId , ComputeResource cluster ) throws FilterInUse , InvalidArgument , InvalidState , NotFound , RuntimeFault , RemoteException { return new Task ( getServerConnection ( ) , getVimService ( ) . uninstallIoFilter_Task ( getMOR ( ) , filterId , cluster . getMOR ( ) ) ) ; }
Uninstall an IO Filter on a compute resource . IO Filters can only be installed on a cluster .
4,360
public Task upgradeIoFilter_Task ( String filterId , ComputeResource cluster , String vibUrl ) throws InvalidArgument , InvalidState , NotFound , RuntimeFault , RemoteException { return new Task ( getServerConnection ( ) , getVimService ( ) . upgradeIoFilter_Task ( getMOR ( ) , filterId , cluster . getMOR ( ) , vibUrl ) ) ; }
Upgrade an IO Filter on a compute resource .
4,361
public static void trustAllHttpsCertificates ( ) throws NoSuchAlgorithmException , KeyManagementException { TrustManager [ ] trustAllCerts = new TrustManager [ 1 ] ; trustAllCerts [ 0 ] = new TrustAllManager ( ) ; SSLContext sc = SSLContext . getInstance ( "SSL" ) ; sc . init ( null , trustAllCerts , null ) ; HttpsURLConnection . setDefaultSSLSocketFactory ( sc . getSocketFactory ( ) ) ; }
This is an unsafe method and should not be used . It will be removed at the next MAJOR release of vSphere
4,362
public HostConnectInfo queryConnectionInfoViaSpec ( HostConnectSpec spec ) throws GatewayConnectFault , GatewayHostNotReachable , GatewayNotFound , GatewayNotReachable , GatewayOperationRefused , GatewayToHostAuthFault , GatewayToHostTrustVerifyFault , HostConnectFault , InvalidArgument , InvalidLogin , RuntimeFault , RemoteException { return getVimService ( ) . queryConnectionInfoViaSpec ( getMOR ( ) , spec ) ; }
This method provides a way of getting basic information about a host without adding it to a datacenter . This method is similar to QueryConnectionInfo but it takes a HostConnectSpec as argument instead of list of parameters .
4,363
public ManagedEntity findByInventoryPath ( String inventoryPath ) throws RuntimeFault , RemoteException { ManagedObjectReference mor = getVimService ( ) . findByInventoryPath ( getMOR ( ) , inventoryPath ) ; return MorUtil . createExactManagedEntity ( getServerConnection ( ) , mor ) ; }
find a managed object in the inventory tree .
4,364
public ManagedEntity findByIp ( Datacenter datacenter , String ip , boolean vmOnly ) throws RuntimeFault , RemoteException { ManagedObjectReference mor = getVimService ( ) . findByIp ( getMOR ( ) , datacenter == null ? null : datacenter . getMOR ( ) , ip , vmOnly ) ; return MorUtil . createExactManagedEntity ( getServerConnection ( ) , mor ) ; }
Find a Virtual Machine or Host System by its IP address .
4,365
public ManagedEntity findByDnsName ( Datacenter datacenter , String dnsName , boolean vmOnly ) throws RuntimeFault , RemoteException { ManagedObjectReference mor = getVimService ( ) . findByDnsName ( getMOR ( ) , datacenter == null ? null : datacenter . getMOR ( ) , dnsName , vmOnly ) ; return MorUtil . createExactManagedEntity ( getServerConnection ( ) , mor ) ; }
Find a VM or Host by its DNS name
4,366
public VirtualMachine findByDatastorePath ( Datacenter datacenter , String dPath ) throws InvalidDatastore , RuntimeFault , RemoteException { if ( datacenter == null ) { throw new IllegalArgumentException ( "datacenter must not be null." ) ; } ManagedObjectReference mor = getVimService ( ) . findByDatastorePath ( getMOR ( ) , datacenter . getMOR ( ) , dPath ) ; return ( VirtualMachine ) MorUtil . createExactManagedEntity ( getServerConnection ( ) , mor ) ; }
Find a VM by its location on a datastore
4,367
public ManagedEntity findChild ( ManagedEntity parent , String name ) throws RuntimeFault , RemoteException { if ( parent == null ) { throw new IllegalArgumentException ( "parent entity must not be null." ) ; } ManagedObjectReference mor = getVimService ( ) . findChild ( getMOR ( ) , parent . getMOR ( ) , name ) ; return MorUtil . createExactManagedEntity ( getServerConnection ( ) , mor ) ; }
Find a child entity under a ManagedObjectReference in the inventory .
4,368
public void createRegistryKeyInGuest ( VirtualMachine vm , GuestAuthentication auth , GuestRegKeyNameSpec keyName , boolean isVolatile , String classType ) throws GuestComponentsOutOfDate , GuestOperationsFault , GuestOperationsUnavailable , GuestPermissionDenied , GuestRegistryKeyAlreadyExists , GuestRegistryKeyInvalid , GuestRegistryKeyParentVolatile , InvalidGuestLogin , InvalidPowerState , InvalidState , OperationDisabledByGuest , OperationNotSupportedByGuest , RuntimeFault , TaskInProgress , RemoteException { getVimService ( ) . createRegistryKeyInGuest ( getMOR ( ) , vm . getMOR ( ) , auth , keyName , isVolatile , classType ) ; }
Create a registry key .
4,369
public void deleteRegistryKeyInGuest ( VirtualMachine vm , GuestAuthentication auth , GuestRegKeyNameSpec keyName , boolean recursive ) throws GuestComponentsOutOfDate , GuestOperationsFault , GuestOperationsUnavailable , GuestPermissionDenied , GuestRegistryKeyHasSubkeys , GuestRegistryKeyInvalid , InvalidGuestLogin , InvalidPowerState , InvalidState , OperationDisabledByGuest , OperationNotSupportedByGuest , RuntimeFault , TaskInProgress , RemoteException { getVimService ( ) . deleteRegistryKeyInGuest ( getMOR ( ) , vm . getMOR ( ) , auth , keyName , recursive ) ; }
Delete a registry key .
4,370
public void deleteRegistryValueInGuest ( VirtualMachine vm , GuestAuthentication auth , GuestRegValueNameSpec valueName ) throws GuestComponentsOutOfDate , GuestOperationsFault , GuestOperationsUnavailable , GuestPermissionDenied , GuestRegistryKeyInvalid , GuestRegistryValueNotFound , InvalidGuestLogin , InvalidPowerState , InvalidState , OperationDisabledByGuest , OperationNotSupportedByGuest , RuntimeFault , TaskInProgress , RemoteException { getVimService ( ) . deleteRegistryValueInGuest ( getMOR ( ) , vm . getMOR ( ) , auth , valueName ) ; }
Delete a registry value .
4,371
public GuestRegKeyRecordSpec [ ] listRegistryKeysInGuest ( VirtualMachine vm , GuestAuthentication auth , GuestRegKeyNameSpec keyName , boolean recursive , String matchPattern ) throws GuestComponentsOutOfDate , GuestOperationsFault , GuestOperationsUnavailable , GuestPermissionDenied , GuestRegistryKeyInvalid , InvalidGuestLogin , InvalidPowerState , InvalidState , OperationDisabledByGuest , OperationNotSupportedByGuest , RuntimeFault , TaskInProgress , RemoteException { return getVimService ( ) . listRegistryKeysInGuest ( getMOR ( ) , vm . getMOR ( ) , auth , keyName , recursive , matchPattern ) ; }
List all registry subkeys for a given registry key .
4,372
public GuestRegValueSpec [ ] listRegistryValuesInGuest ( VirtualMachine vm , GuestAuthentication auth , GuestRegKeyNameSpec keyName , boolean expandStrings , String matchPattern ) throws GuestComponentsOutOfDate , GuestOperationsFault , GuestOperationsUnavailable , GuestPermissionDenied , GuestRegistryKeyInvalid , InvalidGuestLogin , InvalidPowerState , InvalidState , OperationDisabledByGuest , OperationNotSupportedByGuest , RuntimeFault , TaskInProgress , RemoteException { return getVimService ( ) . listRegistryValuesInGuest ( getMOR ( ) , vm . getMOR ( ) , auth , keyName , expandStrings , matchPattern ) ; }
List all registry values for a given registry key .
4,373
public void updateSystemUsers ( String [ ] users ) throws InvalidArgument , RuntimeFault , UserNotFound , RemoteException { getVimService ( ) . updateSystemUsers ( getMOR ( ) , users ) ; }
Update the list of local system users . The special users dcui vpxuser and vslauser need not be specified . They are always reported in the list of system users .
4,374
public DistributedVirtualSwitchProductSpec [ ] queryAvailableDvsSpec ( Boolean recommended ) throws RuntimeFault , RemoteException { return getVimService ( ) . queryAvailableDvsSpec ( getMOR ( ) , recommended ) ; }
This operation returns a list of switch product specifications that are supported by the vCenter Server .
4,375
public Object getCopy ( ManagedObject mo , String propName ) { Object obj = get ( mo . getMOR ( ) , propName ) ; try { obj = DeepCopier . deepCopy ( obj ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return obj ; }
Get a copy of the cached property . You can change the returned object as you like
4,376
public void start ( ) { mThread = new Thread ( mom ) ; mThread . setName ( "MonitorThead for " + si . getServerConnection ( ) . getUrl ( ) ) ; mThread . start ( ) ; }
Start the caching service . Called after specifying the managed objects and their properties to watch .
4,377
public void destroy ( ) { mom . cleanUp ( ) ; mThread . stop ( ) ; si = null ; mom = null ; cache = null ; mThread = null ; }
Destroy the caching service when no longer needed .
4,378
public Task dvsReconfigureVmVnicNetworkResourcePool_Task ( DvsVmVnicResourcePoolConfigSpec [ ] configSpec ) throws ConcurrentAccess , ConflictingConfiguration , DvsFault , DvsNotAuthorized , InvalidName , NotFound , NotSupported , ResourceInUse , RuntimeFault , RemoteException { ManagedObjectReference taskMor = getVimService ( ) . dvsReconfigureVmVnicNetworkResourcePool_Task ( getMOR ( ) , configSpec ) ; return new Task ( getServerConnection ( ) , taskMor ) ; }
Reconfigure the Virtual NIC network resource pool configuration .
4,379
public Task addStandaloneHost_Task ( HostConnectSpec spec , ComputeResourceConfigSpec compResSpec , boolean addConnected , String license ) throws InvalidLogin , HostConnectFault , RuntimeFault , RemoteException { return new Task ( getServerConnection ( ) , getVimService ( ) . addStandaloneHost_Task ( getMOR ( ) , spec , compResSpec , addConnected , license ) ) ; }
new 4 . 0 signature
4,380
public void installSmartCardTrustAnchor ( String cert ) throws HostConfigFault , RuntimeFault , RemoteException { getVimService ( ) . installSmartCardTrustAnchor ( getMOR ( ) , cert ) ; }
Install a trust anchor certificate for smart card authentication .
4,381
public void removeSmartCardTrustAnchor ( String issuer , String serial ) throws HostConfigFault , RuntimeFault , RemoteException { getVimService ( ) . removeSmartCardTrustAnchor ( getMOR ( ) , issuer , serial ) ; }
Remove a smart card trust anchor certificate from the system .
4,382
public void removeSmartCardTrustAnchorByFingerprint ( String fingerprint , String digest ) throws HostConfigFault , RuntimeFault , RemoteException { getVimService ( ) . removeSmartCardTrustAnchorByFingerprint ( getMOR ( ) , fingerprint , digest ) ; }
Remove a smart card trust anchor certificate from the system by fingerprint .
4,383
public Datastore createVvolDatastore ( HostDatastoreSystemVvolDatastoreSpec spec ) throws DuplicateName , HostConfigFault , InvalidName , NotFound , RuntimeFault , RemoteException { ManagedObjectReference dsMor = getVimService ( ) . createVvolDatastore ( getMOR ( ) , spec ) ; return new Datastore ( getServerConnection ( ) , dsMor ) ; }
Create a Virtual - Volume based datastore
4,384
public static Object deepCopy ( Object src ) throws InstantiationException , IllegalAccessException { Class < ? > clazz = src . getClass ( ) ; if ( Modifier . isFinal ( clazz . getModifiers ( ) ) ) { return src ; } Object dst = clazz . newInstance ( ) ; if ( src instanceof Calendar ) { ( ( Calendar ) dst ) . setTimeInMillis ( ( ( Calendar ) src ) . getTimeInMillis ( ) ) ; return dst ; } Field [ ] fields = clazz . getFields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { Object fObj = fields [ i ] . get ( src ) ; if ( fObj == null ) { continue ; } Class < ? > fRealType = fObj . getClass ( ) ; if ( ( ! fRealType . isPrimitive ( ) ) || ( ! fRealType . isEnum ( ) ) || fRealType . getPackage ( ) != JAVA_LANG_PKG ) { if ( fRealType . isArray ( ) ) { Object [ ] items = ( Object [ ] ) fObj ; fObj = Array . newInstance ( fRealType . getComponentType ( ) , items . length ) ; for ( int j = 0 ; j < items . length ; j ++ ) { Array . set ( fObj , j , deepCopy ( items [ j ] ) ) ; } } else { fObj = deepCopy ( fObj ) ; } } fields [ i ] . set ( dst , fObj ) ; } return dst ; }
This is used to clone an data object in VI SDK . The algorithm used here is NOT generic enough to be used in other cases .
4,385
public static String getTargetNameSpace ( String target ) throws IOException { String version = "" ; String urlStr = "https://" + target + "/sdk/vimService?wsdl" ; try { trustAllHttpsCertificates ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } HttpsURLConnection . setDefaultHostnameVerifier ( new HostnameVerifier ( ) { public boolean verify ( String urlHostName , SSLSession session ) { return true ; } } ) ; URL url = new URL ( urlStr ) ; HttpURLConnection conn = ( HttpURLConnection ) url . openConnection ( ) ; conn . connect ( ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( conn . getInputStream ( ) ) ) ; String xmlWSDL = "" ; String line ; while ( ( line = in . readLine ( ) ) != null ) { xmlWSDL = xmlWSDL + line ; } int start = xmlWSDL . indexOf ( "targetNamespace" ) + "targetNamespace" . length ( ) ; start = xmlWSDL . indexOf ( "\"" , start ) ; int end = xmlWSDL . indexOf ( "\"" , start + 1 ) ; version = xmlWSDL . substring ( start + 1 , end ) ; return version ; }
Retrieve the target server s name space
4,386
public void logout ( ) { if ( vimService != null ) { try { serviceInstance . getSessionManager ( ) . logout ( ) ; } catch ( Exception e ) { System . err . println ( "Failed to disconnect..." ) ; } vimService = null ; serviceInstance = null ; } }
Disconnect from the server and clean up
4,387
public String createVRP ( VirtualResourcePoolSpec spec ) throws InsufficientResourcesFault , InvalidState , RuntimeFault , RemoteException { return getVimService ( ) . createVRP ( getMOR ( ) , spec ) ; }
Creates a new Virtual Resource Pool .
4,388
public void deleteVRP ( String vrpId ) throws InvalidState , NotFound , RuntimeFault , RemoteException { getVimService ( ) . deleteVRP ( getMOR ( ) , vrpId ) ; }
Deletes a VRP with the given Id if it exists . During deletion all of the child resource pools under the hubs will be deleted . If there are any VMs under those resource pools they will be moved directly under the hub . For hubs that are cluster those VMs will be moved to the root resource pool .
4,389
public ResourcePool getChildRPforHub ( String vrpId , ManagedEntity hub ) throws InvalidState , NotFound , RuntimeFault , RemoteException { ManagedObjectReference rpMor = getVimService ( ) . getChildRPforHub ( getMOR ( ) , vrpId , hub . getMOR ( ) ) ; return new ResourcePool ( getServerConnection ( ) , rpMor ) ; }
Given the VRP Id and a hub gets the associated child resource pool .
4,390
public ResourceConfigSpec getRPSettings ( ResourcePool resourcePool ) throws NotFound , RuntimeFault , RemoteException { return getVimService ( ) . getRPSettings ( getMOR ( ) , resourcePool . getMOR ( ) ) ; }
Get ResourceConfigSpec for a resource pool that is under a member hub of some VRP . This is to get the settings that DRS generated for that child resource pool . The setting might be absent for recently added resource pools .
4,391
public String getVRPofVM ( VirtualMachine vm ) throws InvalidState , NotFound , RuntimeFault , RemoteException { return getVimService ( ) . getVRPofVM ( getMOR ( ) , vm . getMOR ( ) ) ; }
Get the ID of the VRP a VM belongs to . If the VM does not belong to any VRP the returned optional string will not be set to any value .
4,392
public VirtualResourcePoolSpec getVRPSettings ( String vrpId ) throws InvalidState , NotFound , RuntimeFault , RemoteException { return getVimService ( ) . getVRPSettings ( getMOR ( ) , vrpId ) ; }
Get the settings for a VRP with the given Id if it exists . The returned VirtualResourcePoolSpec object will have all of its fields populated .
4,393
public VirtualResourcePoolUsage getVRPUsage ( String vrpId ) throws InvalidState , NotFound , RuntimeFault , RemoteException { return getVimService ( ) . getVRPUsage ( getMOR ( ) , vrpId ) ; }
Get the usage values for a VRP with the given Id .
4,394
public void setManagedByVDC ( ClusterComputeResource cluster , boolean status ) throws InvalidState , NotFound , RuntimeFault , RemoteException { getVimService ( ) . setManagedByVDC ( getMOR ( ) , cluster . getMOR ( ) , status ) ; }
Sets whether a cluster is managed by a Virtual Datacenter . Setting this to true will prevent users from disabling DRS for the cluster .
4,395
public void undeployVM ( String vrpId , VirtualMachine vm , ClusterComputeResource cluster ) throws InvalidState , NotFound , RuntimeFault , RemoteException { getVimService ( ) . undeployVM ( getMOR ( ) , vrpId , vm . getMOR ( ) , cluster . getMOR ( ) ) ; }
Undeploy a VM in given VRP hub pair .
4,396
public void updateVRP ( VRPEditSpec spec ) throws InvalidState , NotFound , RuntimeFault , RemoteException , InsufficientResourcesFault { getVimService ( ) . updateVRP ( getMOR ( ) , spec ) ; }
Updates the configuration of an existing VRP .
4,397
private void onCursorChanged ( final Event event , final Suggestion < T > suggestion ) { TypeaheadCursorChangedEvent . fire ( this , suggestion , event ) ; }
Triggered when the dropdown menu cursor is moved to a different suggestion .
4,398
private void onAutoCompleted ( final Event event , final Suggestion < T > suggestion ) { TypeaheadAutoCompletedEvent . fire ( this , suggestion , event ) ; }
Triggered when the query is autocompleted . Autocompleted means the query was changed to the hint .
4,399
private void onSelected ( final Event event , final Suggestion < T > suggestion ) { TypeaheadSelectedEvent . fire ( this , suggestion , event ) ; }
Triggered when a suggestion from the dropdown menu is selected .