Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors
   * as indicated by the @authors tag. All rights reserved.
   * See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
  * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * 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,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
 package org.jboss.as.host.controller;
 
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.HOST;
 
Utility for creating the root element and populating the org.jboss.as.controller.registry.ManagementResourceRegistration for an individual host's portion of the model.

Author(s):
Brian Stansberry (c) 2011 Red Hat Inc.
Darran Lofthouse
James R. Perkins
 
 public class HostModelUtil {
 
     public interface HostModelRegistrar {
         void registerHostModel(final String hostNamefinal ManagementResourceRegistration root);
     }
 
     public static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) {
         StringBuilder prefix = new StringBuilder();
         for (String kp : keyPrefix) {
             prefix.append('.').append(kp);
         }
         return new StandardResourceDescriptionResolver(prefix.toString(), HostEnvironmentResourceDefinition.class.getPackage().getName() + ".LocalDescriptions"HostModelUtil.class.getClassLoader(), truefalse);
     }
 
 
     public static void createRootRegistry(final ManagementResourceRegistration rootfinal HostControllerEnvironment environment,
                                           final IgnoredDomainResourceRegistry ignoredDomainResourceRegistry,
                                           final HostModelRegistrar hostModelRegistrar,
                                           final ProcessType processType,
                                           final DelegatingConfigurableAuthorizer authorizer) {
         // Add of the host itself
         final HostModelRegistrationHandler hostModelRegistratorHandler = new HostModelRegistrationHandler(environmentignoredDomainResourceRegistryhostModelRegistrar);
         root.registerOperationHandler(.hostModelRegistratorHandler);
 
         // Global operations
         GlobalOperationHandlers.registerGlobalOperations(rootprocessType);
         // Global notifications
         GlobalNotifications.registerGlobalNotifications(rootprocessType);
 
         if (root.getOperationEntry(...getName())==null){//this is hack
         }
         root.registerOperationHandler(., WhoAmIOperation.createOperation(authorizer), true);
 
         // Other root resource operations
     }
 
     public static void createHostRegistry(final String hostName,
                                           final ManagementResourceRegistration rootfinal HostControllerConfigurationPersister configurationPersister,
                                           final HostControllerEnvironment environmentfinal HostRunningModeControl runningModeControl,
                                          final HostFileRepository localFileRepository,
                                          final LocalHostControllerInfoImpl hostControllerInfofinal ServerInventory serverInventory,
                                          final HostFileRepository remoteFileRepository,
                                          final ContentRepository contentRepository,
                                          final DomainController domainController,
                                          final ExtensionRegistry extensionRegistry,
                                          final AbstractVaultReader vaultReader,
                                          final IgnoredDomainResourceRegistry ignoredRegistry,
                                          final ControlledProcessState processState,
                                          final PathManagerService pathManager,
                                          final DelegatingConfigurableAuthorizer authorizer,
                                          final ManagedAuditLogger auditLogger) {
        // Add of the host itself
        ManagementResourceRegistration hostRegistration = root.registerSubModel(
                new HostResourceDefinition(hostNameconfigurationPersister,
                        environmentrunningModeControllocalFileRepository,
                        hostControllerInfoserverInventoryremoteFileRepository,
                        contentRepositorydomainControllerextensionRegistry,
                        vaultReaderignoredRegistryprocessStatepathManagerauthorizerauditLogger));
        //TODO See if some of all these parameters can come from domain controller
        LocalDomainControllerAddHandler localDcAddHandler = LocalDomainControllerAddHandler.getInstance(roothostControllerInfo,
                configurationPersisterlocalFileRepositorycontentRepositorydomainControllerextensionRegistrypathManager);
        hostRegistration.registerOperationHandler(.localDcAddHandler);
        RemoteDomainControllerAddHandler remoteDcAddHandler = new RemoteDomainControllerAddHandler(roothostControllerInfodomainController,
                configurationPersistercontentRepositoryremoteFileRepositoryextensionRegistryignoredRegistrypathManager);
        hostRegistration.registerOperationHandler(.remoteDcAddHandler);
    }
New to GrepCode? Check out our FAQ X