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.ejb3.subsystem;
 
 
 
 import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.*;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.CORE_THREADS;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT_MDB_INSTANCE_POOL;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT_RESOURCE_ADAPTER_NAME;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT_SLSB_INSTANCE_POOL;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.INSTANCE_ACQUISITION_TIMEOUT;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.INSTANCE_ACQUISITION_TIMEOUT_UNIT;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.LITE;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.MAX_POOL_SIZE;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.MAX_THREADS;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.PATH;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.RELATIVE_TO;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.SERVICE;
 import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.STRICT_MAX_BEAN_INSTANCE_POOL;

Static utilities containing subsystem resource and operation descriptions. Separated from the org.jboss.as.controller.descriptions.DescriptionProvider implementations so the cost of loading this code doesn't get incurred during boot time

User: jpai

 
 public class EJB3SubsystemDescriptions {
 
     static final String RESOURCE_NAME = EJB3SubsystemProviders.class.getPackage().getName() + ".LocalDescriptions";
 
     static final ModelNode getSubystemDescription(final Locale locale) {
         final ResourceBundle bundle = getResourceBundle(locale);
 
         final ModelNode subsystem = new ModelNode();
         subsystem.get().set(bundle.getString("ejb3"));
         subsystem.get().set(true);
         subsystem.get().set(true);
         subsystem.get().set(.);
 
         subsystem.get().set(.);
         subsystem.get().set(bundle.getString("ejb3.lite"));
         subsystem.get().set(false);
         subsystem.get().set(false);
 
         subsystem.get().set(bundle.getString("ejb3.default-mdb-instance-pool"));
         subsystem.get().set(false);
 
         subsystem.get().set(bundle.getString("ejb3.default-slsb-instance-pool"));
         subsystem.get().set(false);
 
         subsystem.get().set(bundle.getString("ejb3.default-resource-adapter-name"));
         subsystem.get().set(false);
 
         subsystem.get(); // placeholder
 
         subsystem.get().set(bundle.getString("ejb3.service"));
         subsystem.get().set(0);
         subsystem.get();
 
         subsystem.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool"));
         subsystem.get().set(0);
 
         return subsystem;
     }
 
    static final ModelNode getSubystemAddDescription(final Locale locale) {
        final ResourceBundle bundle = getResourceBundle(locale);
        final ModelNode op = new ModelNode();
        op.get().set();
        op.get().set(bundle.getString("ejb3.add"));
        op.get().set(bundle.getString("ejb3.lite"));
        op.get().set(false);
        op.get().set(false);
        op.get().set(bundle.getString("ejb3.default-mdb-instance-pool"));
        op.get().set(bundle.getString("ejb3.default-slsb-instance-pool"));
        op.get().set(bundle.getString("ejb3.default-resource-adapter-name"));
        op.get().setEmptyObject();
        return op;
    }
    static ModelNode getTimerServiceDescription(Locale locale) {
        final ResourceBundle bundle = getResourceBundle(locale);
        final ModelNode description = new ModelNode();
        description.get().set(bundle.getString("ejb3.timerservice"));
        // setup the "max-pool-size" param description
        description.get().set(bundle.getString("ejb3.timerservice.maxThreads"));
        description.get().set(.);
        description.get().set(false);
        // This is wrong in a domain, as the number of available processors varies from host to host. Just explain the default in the description
//        description.get(ATTRIBUTES, MAX_THREADS, DEFAULT).set(Runtime.getRuntime().availableProcessors());
        description.get().set(bundle.getString("ejb3.timerservice.coreThreads"));
        description.get().set(.);
        description.get().set(false);
        description.get().set(0);
        description.get().set(0);
        description.get().set(bundle.getString("ejb3.timerservice.path"));
        description.get().set(.);
        description.get().set(false);
        description.get().set(bundle.getString("ejb3.timerservice.relativeTo"));
        description.get().set(.);
        description.get().set(false);
        description.get(); // placeholder
        description.get().setEmptyObject();
        return description;
    }

    
Description provider for the timer-service add operation
        final ResourceBundle bundle = getResourceBundle(locale);
        final ModelNode description = new ModelNode();
        // set the description of this operation
        description.get(.).set(bundle.getString("ejb3.timerservice.add"));
        // setup the "max-pool-size" param description
        description.get().set(bundle.getString("ejb3.timerservice.maxThreads"));
        description.get().set(.);
        description.get().set(false);
        description.get().set(Runtime.getRuntime().availableProcessors());
        description.get().set(bundle.getString("ejb3.timerservice.coreThreads"));
        description.get().set(.);
        description.get().set(false);
        description.get().set(0);
        description.get().set(bundle.getString("ejb3.timerservice.path"));
        description.get().set(.);
        description.get().set(false);
        description.get().set(bundle.getString("ejb3.timerservice.relativeTo"));
        description.get().set(.);
        description.get().set(false);
        return description;
    }
        final ResourceBundle bundle = getResourceBundle(locale);
        final ModelNode description = new ModelNode();
        // setup the description
        description.get().set(bundle.getString("ejb3.timerservice.remove"));
        return description;
    }
        final ResourceBundle bundle = getResourceBundle(locale);
        final ModelNode description = new ModelNode();
        // setup the description for the strict-max-bean-instance-pool address
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool"));
        // setup the "max-pool-size" param description
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool.max-pool-size"));
        description.get().set(.);
        description.get().set(false);
        // setup the "timeout" param description
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool.instance-acquisition-timeout"));
        description.get().set(false);
        // setup the "timeout-unit" param description
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool.instance-acquisition-timeout-unit"));
        description.get().set(false);
        description.get(); // placeholder
        description.get().setEmptyObject();
        return description;
    }
        final ResourceBundle bundle = getResourceBundle(locale);
        final ModelNode description = new ModelNode();
        // set the description of this operation
        description.get(.).set(bundle.getString("ejb3.strict-max-bean-instance-pool.add"));
        // setup the "max-pool-size" param description
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool.max-pool-size"));
        description.get().set(.);
        description.get().set(false);
        // setup the "timeout" param description
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool.instance-acquisition-timeout"));
        description.get().set(false);
        // setup the "timeout-unit" param description
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool.instance-acquisition-timeout-unit"));
        return description;
    }
        final ResourceBundle bundle = getResourceBundle(locale);
        final ModelNode description = new ModelNode();
        // setup the description
        description.get().set(bundle.getString("ejb3.strict-max-bean-instance-pool.remove"));
        return description;
    }
    private static ResourceBundle getResourceBundle(Locale locale) {
        if (locale == null) {
            locale = Locale.getDefault();
        }
        return ResourceBundle.getBundle(locale);
    }
New to GrepCode? Check out our FAQ X