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 .