private void addReferences(ModelNode feature, ImmutableManagementResourceRegistration registration) {
        PathAddress address = registration.getPathAddress();
        if (address == null || PathAddress.EMPTY_ADDRESS.equals(address)) {
            return;
        }
        ModelNode refs = feature.get(REFS).setEmptyList();
        if (registration.getParent() != null && registration.getParent().isFeature()) {
            addReference(refs, registration.getParent());
        }
        PathElement element = registration.getPathAddress().getLastElement();
        if (SUBSYSTEM.equals(element.getKey())) {
            ModelNode ref = new ModelNode();
            final String rootType = registration.getPathAddress().getElement(0).getKey();
            if (HOST.equals(rootType)) {
                ref.get(FEATURE).set(HOST_EXTENSION);
            } else if (PROFILE.equals(rootType)) {
                ref.get(FEATURE).set(DOMAIN_EXTENSION);
            } else {
                ref.get(FEATURE).set(EXTENSION);
            }
            ref.get(INCLUDE).set(true);
            refs.add(ref);
        }
        if (refs.asList().isEmpty()) {
            feature.remove(REFS);
        }
    }
private void addReferences ( ModelNode feature , ImmutableManagementResourceRegistration registration ) { PathAddress address = registration . getPathAddress ( ) ; if ( address == null || PathAddress . EMPTY_ADDRESS . equals ( address ) ) { return ; } ModelNode refs = feature . get ( REFS ) . setEmptyList ( ) ; if ( registration . getParent ( ) != null && registration . getParent ( ) . isFeature ( ) ) { addReference ( refs , registration . getParent ( ) ) ; } PathElement element = registration . getPathAddress ( ) . getLastElement ( ) ; if ( SUBSYSTEM . equals ( element . getKey ( ) ) ) { ModelNode ref = new ModelNode ( ) ; final String rootType = registration . getPathAddress ( ) . getElement ( 0 ) . getKey ( ) ; if ( HOST . equals ( rootType ) ) { ref . get ( FEATURE ) . set ( HOST_EXTENSION ) ; } else if ( PROFILE . equals ( rootType ) ) { ref . get ( FEATURE ) . set ( DOMAIN_EXTENSION ) ; } else { ref . get ( FEATURE ) . set ( EXTENSION ) ; } ref . get ( INCLUDE ) . set ( true ) ; refs . add ( ref ) ; } if ( refs . asList ( ) . isEmpty ( ) ) { feature . remove ( REFS ) ; } }
}