@@ -84,16 +84,14 @@ public HostConfigManager getHostConfigManager() throws Exception {
8484 return (HostConfigManager )_context .getVimClient ().getDynamicProperty (_mor , "configManager" );
8585 }
8686
87- public VirtualNicManagerNetConfig [] getHostVirtualNicManagerNetConfig () throws Exception {
88- VirtualNicManagerNetConfig [] netConfigs = ( VirtualNicManagerNetConfig [] )_context .getVimClient ().getDynamicProperty (_mor ,
87+ public List < VirtualNicManagerNetConfig > getHostVirtualNicManagerNetConfig () throws Exception {
88+ return ( List < VirtualNicManagerNetConfig > )_context .getVimClient ().getDynamicProperty (_mor ,
8989 "config.virtualNicManagerInfo.netConfig" );
90- return netConfigs ;
9190 }
9291
93- public HostIpRouteEntry [] getHostIpRouteEntries () throws Exception {
94- HostIpRouteEntry [] entries = ( HostIpRouteEntry [] )_context .getVimClient ().getDynamicProperty (_mor ,
92+ public List < HostIpRouteEntry > getHostIpRouteEntries () throws Exception {
93+ return ( List < HostIpRouteEntry > )_context .getVimClient ().getDynamicProperty (_mor ,
9594 "config.network.routeTableInfo.ipRoute" );
96- return entries ;
9795 }
9896
9997 public HostListSummaryQuickStats getHostQuickStats () throws Exception {
@@ -142,7 +140,7 @@ public ClusterDasConfigInfo getDasConfig() throws Exception {
142140
143141 @ Override
144142 public String getHyperHostDefaultGateway () throws Exception {
145- HostIpRouteEntry [] entries = getHostIpRouteEntries ();
143+ List < HostIpRouteEntry > entries = getHostIpRouteEntries ();
146144 for (HostIpRouteEntry entry : entries ) {
147145 if (entry .getNetwork ().equalsIgnoreCase ("0.0.0.0" ))
148146 return entry .getGateway ();
@@ -222,7 +220,7 @@ public ManagedObjectReference getHyperHostCluster() throws Exception {
222220 }
223221
224222 public ManagedObjectReference [] getHostLocalDatastore () throws Exception {
225- ManagedObjectReference [] datastores = (ManagedObjectReference [] )_context .getVimClient ().getDynamicProperty (
223+ List < ManagedObjectReference > datastores = (List < ManagedObjectReference > )_context .getVimClient ().getDynamicProperty (
226224 _mor , "datastore" );
227225 List <ManagedObjectReference > l = new ArrayList <ManagedObjectReference >();
228226 if (datastores != null ) {
@@ -236,7 +234,7 @@ public ManagedObjectReference[] getHostLocalDatastore() throws Exception {
236234 }
237235
238236 public HostVirtualSwitch getHostVirtualSwitchByName (String name ) throws Exception {
239- HostVirtualSwitch [] switches = (HostVirtualSwitch [] )_context .getVimClient ().getDynamicProperty (
237+ List < HostVirtualSwitch > switches = (List < HostVirtualSwitch > )_context .getVimClient ().getDynamicProperty (
240238 _mor , "config.network.vswitch" );
241239
242240 if (switches != null ) {
@@ -248,8 +246,8 @@ public HostVirtualSwitch getHostVirtualSwitchByName(String name) throws Exceptio
248246 return null ;
249247 }
250248
251- public HostVirtualSwitch [] getHostVirtualSwitch () throws Exception {
252- return (HostVirtualSwitch [] )_context .getVimClient ().getDynamicProperty (_mor , "config.network.vswitch" );
249+ public List < HostVirtualSwitch > getHostVirtualSwitch () throws Exception {
250+ return (List < HostVirtualSwitch > )_context .getVimClient ().getDynamicProperty (_mor , "config.network.vswitch" );
253251 }
254252
255253 public AboutInfo getHostAboutInfo () throws Exception {
@@ -285,7 +283,7 @@ public HostVirtualSwitch getPortGroupVirtualSwitch(String portGroupName) throws
285283
286284 public HostVirtualSwitch getVirtualSwitchByName (String vSwitchName ) throws Exception {
287285
288- HostVirtualSwitch [] vSwitchs = getHostVirtualSwitch ();
286+ List < HostVirtualSwitch > vSwitchs = getHostVirtualSwitch ();
289287 if (vSwitchs != null ) {
290288 for (HostVirtualSwitch vSwitch : vSwitchs ) {
291289 if (vSwitch .getName ().equals (vSwitchName ))
@@ -327,7 +325,7 @@ public HostPortGroupSpec getPortGroupSpec(String portGroupName) throws Exception
327325 public String getPortGroupNameByNicType (HostVirtualNicType nicType ) throws Exception {
328326 assert (nicType != null );
329327
330- VirtualNicManagerNetConfig [] netConfigs = (VirtualNicManagerNetConfig [] )_context .getVimClient ().getDynamicProperty (_mor ,
328+ List < VirtualNicManagerNetConfig > netConfigs = (List < VirtualNicManagerNetConfig > )_context .getVimClient ().getDynamicProperty (_mor ,
331329 "config.virtualNicManagerInfo.netConfig" );
332330
333331 if (netConfigs != null ) {
@@ -448,10 +446,10 @@ public ManagedObjectReference getNetworkMor(String portGroupName) throws Excepti
448446 return null ;
449447 }
450448
451- public ManagedObjectReference [] getVmMorsOnNetwork (String portGroupName ) throws Exception {
449+ public List < ManagedObjectReference > getVmMorsOnNetwork (String portGroupName ) throws Exception {
452450 ManagedObjectReference morNetwork = getNetworkMor (portGroupName );
453451 if (morNetwork != null )
454- return (ManagedObjectReference [] )_context .getVimClient ().getDynamicProperty (morNetwork , "vm" );
452+ return (List < ManagedObjectReference > )_context .getVimClient ().getDynamicProperty (morNetwork , "vm" );
455453 return null ;
456454 }
457455
@@ -703,25 +701,25 @@ public boolean createBlankVm(String vmName, int cpuCount, int cpuSpeedMHz, int c
703701 public ManagedObjectReference getExistingDataStoreOnHost (boolean vmfsDatastore , String hostAddress ,
704702 int hostPort , String path , String uuid , HostDatastoreSystemMO hostDatastoreSystemMo ) {
705703 // First retrieve the list of Datastores on the host.
706- ManagedObjectReference [] morArray ;
704+ List < ManagedObjectReference > morArray ;
707705 try {
708706 morArray = hostDatastoreSystemMo .getDatastores ();
709707 } catch (Exception e ) {
710708 s_logger .info ("Failed to retrieve list of Managed Object References" );
711709 return null ;
712710 }
713711 // Next, get all the NAS datastores from this array of datastores.
714- if (morArray .length > 0 ) {
712+ if (morArray .size () > 0 ) {
715713 int i ;
716- for (i = 0 ; i < morArray .length ; i ++) {
714+ for (i = 0 ; i < morArray .size () ; i ++) {
717715 NasDatastoreInfo nasDS ;
718716 try {
719- nasDS = hostDatastoreSystemMo .getNasDatastoreInfo (morArray [ i ] );
717+ nasDS = hostDatastoreSystemMo .getNasDatastoreInfo (morArray . get ( i ) );
720718 if (nasDS != null ) {
721719 //DatastoreInfo info = (DatastoreInfo)_context.getServiceUtil().getDynamicProperty(morDatastore, "info");
722720 if (nasDS .getNas ().getRemoteHost ().equalsIgnoreCase (hostAddress ) &&
723721 nasDS .getNas ().getRemotePath ().equalsIgnoreCase (path )) {
724- return morArray [ i ] ;
722+ return morArray . get ( i ) ;
725723 }
726724 }
727725 } catch (Exception e ) {
@@ -861,13 +859,13 @@ public VmwareHypervisorHostNetworkSummary getHyperHostNetworkSummary(String mana
861859 VmwareHypervisorHostNetworkSummary summary = new VmwareHypervisorHostNetworkSummary ();
862860
863861 if (this .getHostType () == VmwareHostType .ESXi ) {
864- VirtualNicManagerNetConfig [] netConfigs = (VirtualNicManagerNetConfig [] )_context .getVimClient ().getDynamicProperty (_mor ,
862+ List < VirtualNicManagerNetConfig > netConfigs = (List < VirtualNicManagerNetConfig > )_context .getVimClient ().getDynamicProperty (_mor ,
865863 "config.virtualNicManagerInfo.netConfig" );
866864 assert (netConfigs != null );
867865
868- for (int i = 0 ; i < netConfigs . length ; i ++ ) {
869- if (netConfigs [ i ] .getNicType ().equals ("management" )) {
870- for (HostVirtualNic nic : netConfigs [ i ] .getCandidateVnic ()) {
866+ for (VirtualNicManagerNetConfig netConfig : netConfigs ) {
867+ if (netConfig .getNicType ().equals ("management" )) {
868+ for (HostVirtualNic nic : netConfig .getCandidateVnic ()) {
871869 if (nic .getPortgroup ().equals (managementPortGroup )) {
872870 summary .setHostIp (nic .getSpec ().getIp ().getIpAddress ());
873871 summary .setHostNetmask (nic .getSpec ().getIp ().getSubnetMask ());
@@ -882,7 +880,7 @@ public VmwareHypervisorHostNetworkSummary getHyperHostNetworkSummary(String mana
882880 }
883881 } else {
884882 // try with ESX path
885- HostVirtualNic [] hostVNics = (HostVirtualNic [] )_context .getVimClient ().getDynamicProperty (_mor ,
883+ List < HostVirtualNic > hostVNics = (List < HostVirtualNic > )_context .getVimClient ().getDynamicProperty (_mor ,
886884 "config.network.consoleVnic" );
887885
888886 if (hostVNics != null ) {
0 commit comments