static Map < String , Set < String > > getChildAddresses ( final OperationContext context , final PathAddress addr , final ImmutableManagementResourceRegistration registry , Resource resource , final String validChildType ) { Map < String , Set < String > > result = new HashMap <> ( ) ; Predicate < String > validChildTypeFilter = childType -> ( validChildType == null ) || validChildType . equals ( childType ) ; if ( resource != null ) { for ( String childType : registry . getChildNames ( PathAddress . EMPTY_ADDRESS ) ) { if ( validChildTypeFilter . test ( childType ) ) { List < String > list = new ArrayList <> ( ) ; for ( String child : resource . getChildrenNames ( childType ) ) { if ( registry . getSubModel ( PathAddress . pathAddress ( PathElement . pathElement ( childType , child ) ) ) != null ) { list . add ( child ) ; } } result . put ( childType , new LinkedHashSet <> ( list ) ) ; } } } Set < PathElement > paths = registry . getChildAddresses ( PathAddress . EMPTY_ADDRESS ) ; for ( PathElement path : paths ) { String childType = path . getKey ( ) ; if ( validChildTypeFilter . test ( childType ) ) { Set < String > children = result . get ( childType ) ; if ( children == null ) { // WFLY-3306 Ensure we have an entry for any valid child type children = new LinkedHashSet <> ( ) ; result . put ( childType , children ) ; } ImmutableManagementResourceRegistration childRegistration = registry . getSubModel ( PathAddress . pathAddress ( path ) ) ; if ( childRegistration != null ) { AliasEntry aliasEntry = childRegistration . getAliasEntry ( ) ; if ( aliasEntry != null ) { PathAddress childAddr = addr . append ( path ) ; PathAddress target = aliasEntry . convertToTargetAddress ( childAddr , AliasContext . create ( childAddr , context ) ) ; assert ! childAddr . equals ( target ) : "Alias was not translated" ; PathAddress targetParent = target . getParent ( ) ; Resource parentResource = context . readResourceFromRoot ( targetParent , false ) ; if ( parentResource != null ) { PathElement targetElement = target . getLastElement ( ) ; if ( targetElement . isWildcard ( ) ) { children . addAll ( parentResource . getChildrenNames ( targetElement . getKey ( ) ) ) ; } else if ( parentResource . hasChild ( targetElement ) ) { children . add ( path . getValue ( ) ) ; } } } if ( ! path . isWildcard ( ) && childRegistration . isRemote ( ) ) { children . add ( path . getValue ( ) ) ; } } } } return result ; }
Gets the addresses of the child resources under the given resource .