Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2013, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.as.domain.controller.transformers;
 
 
Transformers for the domain-wide management configuration.

Author(s):
Brian Stansberry (c) 2013 Red Hat Inc.
 
 class ManagementTransformers {

    
Transformation for versions prior to support for RBAC (WFLY-490)

Parameters:
domain the domain level registration
 
         // Discard the domain level core-service=management resource and its children unless RBAC is enabled
         // Configuring rbac details is OK (i.e. discarable), so long as the provider is not enabled
         ResourceTransformationDescriptionBuilder builder = TransformationDescriptionBuilder.Factory.createInstance(.);
         builder.setCustomResourceTransformer(new ResourceTransformer() {
             @Override
             public void transformResource(ResourceTransformationContext contextPathAddress addressResource resourcethrows OperationFailedException {
                 Resource accessAuth = resource.getChild(.);
                 if (accessAuth != null) {
                     ModelNode model = accessAuth.getModel();
                     String providerName = ..resolveModelAttribute(.model).asString();
                     AccessAuthorizationResourceDefinition.Provider provider = AccessAuthorizationResourceDefinition.Provider.valueOf(providerName.toUpperCase(.));
                     if (provider != ..) {
                         // Continue to lower levels where this will be rejected
                         final ResourceTransformationContext childContext = context.addTransformedResource(.resource);
                         childContext.processChildren(resource);
                     }
                 }
 
                 // else do nothing, i.e. acts as a discard
             }
         });
             .getAttributeBuilder()
                 .setDiscard(new DiscardAttributeChecker.DefaultDiscardAttributeChecker() {
                     @Override
                     protected boolean isValueDiscardable(PathAddress addressString attributeNameModelNode attributeValueTransformationContext context) {
                         return !attributeValue.isDefined()
                                 || ...toString().equalsIgnoreCase(attributeValue.asString());
                     }
                 }, .)
                 .end();
         accessBuilder.discardChildResource(PathElement.pathElement(.));
         accessBuilder.discardChildResource(PathElement.pathElement(.));
         accessBuilder.discardChildResource(PathElement.pathElement(.));
 
         TransformationDescription.Tools.register(builder.build(), domain);
     }
 
    private ManagementTransformers() {
        // prevent instantiation
    }
New to GrepCode? Check out our FAQ X