Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2011, 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.security;
 
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIBE;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR;
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
 import static org.jboss.as.security.CommonAttributes.AUDIT_MANAGER_CLASS_NAME;
 import static org.jboss.as.security.CommonAttributes.AUTHENTICATION_MANAGER_CLASS_NAME;
 import static org.jboss.as.security.CommonAttributes.AUTHORIZATION_MANAGER_CLASS_NAME;
 import static org.jboss.as.security.CommonAttributes.DEEP_COPY_SUBJECT_MODE;
 import static org.jboss.as.security.CommonAttributes.DEFAULT_CALLBACK_HANDLER_CLASS_NAME;
 import static org.jboss.as.security.CommonAttributes.IDENTITY_TRUST_MANAGER_CLASS_NAME;
 import static org.jboss.as.security.CommonAttributes.MAPPING_MANAGER_CLASS_NAME;
 import static org.jboss.as.security.CommonAttributes.SECURITY_DOMAIN;
 import static org.jboss.as.security.CommonAttributes.SUBJECT_FACTORY_CLASS_NAME;
 
The security extension.

Author(s):
Marcus Moyses
Darran Lofthouse
 
 public class SecurityExtension implements Extension {
 
     private static final Logger log = Logger.getLogger("org.jboss.as.security");
 
     public static final ServiceName JBOSS_SECURITY = ..append("security");
 
     public static final String SUBSYSTEM_NAME = "security";
 
     private static final SecuritySubsystemParser PARSER = SecuritySubsystemParser.getInstance();
 
     @Override
     public void initialize(ExtensionContext context) {
         .debug("Initializing Security Extension");
 
         final SubsystemRegistration subsystem = context.registerSubsystem();
         final ModelNodeRegistration registration = subsystem.registerSubsystemModel(.);
                 false);
 
         // security domains
         final ModelNodeRegistration securityDomain = registration.registerSubModel(PathElement
                 .false);
                 .false);
 
         subsystem.registerXMLElementWriter();
     }
 
     @Override
     public void initializeParsers(ExtensionParsingContext context) {
     }
    private static class SecurityDescribeHandler implements ModelQueryOperationHandler {
        static final SecurityDescribeHandler INSTANCE = new SecurityDescribeHandler();
        @Override
        public OperationResult execute(final OperationContext contextfinal ModelNode operationfinal ResultHandler resultHandler) {
            final ModelNode model = context.getSubModel();
            final ModelNode subsystem = new ModelNode();
            subsystem.get().set();
            subsystem.get().add();
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            if (model.hasDefined()) {
                subsystem.get().set(model.get());
            }
            ModelNode result = new ModelNode();
            result.add(subsystem);
            if (model.hasDefined()) {
                for (Property prop : model.get().asPropertyList()) {
                    final ModelNode addr = subsystem.get().clone().add(prop.getName());
                    result.add(SecurityDomainAdd.getRecreateOperation(addrprop.getValue()));
                }
            }
            resultHandler.handleResultFragment(.result);
            resultHandler.handleResultComplete();
            return new BasicOperationResult();
        }
    }
New to GrepCode? Check out our FAQ X