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 java.util.List;
 
 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.LITE;
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.TIMER_SERVICE;

Add operation handler for the EJB3 subsystem.

Author(s):
Emanuel Muckenhuber
    static final EJB3SubsystemAdd INSTANCE = new EJB3SubsystemAdd();
    private static final Logger logger = Logger.getLogger(EJB3SubsystemAdd.class);
    private EJB3SubsystemAdd() {
        //
    }
    @Override
    public ModelNode getModelDescription(final Locale locale) {
        return EJB3SubsystemDescriptions.getSubystemAddDescription(locale);
    }
    protected void populateModel(ModelNode operationModelNode model) {
        model.get().set(operation.get());
    }
    protected void performBoottime(final OperationContext contextModelNode operationfinal ModelNode modelServiceVerificationHandler verificationHandlerList<ServiceController<?>> newControllers) {
        context.addStep(new AbstractDeploymentChainStep() {
            protected void execute(DeploymentProcessorTarget processorTarget) {
                // we skip timerservice processing if strict webprofile is desired
                // WARNING: This is a bit funky as we are configuring TimeoutAnnotationProcessor in the subsystem
                // root add handler based on configuration that will be done in a later handler, for a child resource
                // (TimerServiceAdd). This can work because if this and TimerServiceAdd are run as part of the same
                // composite op or set of boot operations, this Stage.RUNTIME handler will execute after TimerServiceAdd's
                // Stage.MODEL handler runs. So the model check that's done in the 'if' test below works. But this
                // would fail if TimerServiceAdd were run in a separate set of operations.
                // The reason it's ok is because this and TimerServiceAdd are boot time handlers, so these runtime
                // changes will only happen as a group as part of the set of boot time ops. But it's fragile.
                // TODO look into a way to have TimerServiceAdd toggle the state of the TimeoutAnnotationProcessor we add here.
                boolean timerServiceEnabled = false;
                boolean lite = model.hasDefined() && model.get().asBoolean();
                if (!lite && context.readResource(.).hasChild(.)) {
                    timerServiceEnabled = true;
                }
                //we still parse these annotations even if the timer service is not enabled
                //so we can log a warning about any @Schedule annotations we find
                processorTarget.addDeploymentProcessor(..new TimeoutAnnotationProcessor(timerServiceEnabled));
                // add the metadata parser deployment processor
                processorTarget.addDeploymentProcessor(..new EjbJarParsingDeploymentUnitProcessor());
                // If strict EE webprofile compliance is desired then skip MDB processing
                if (! lite) {
                    .debug("Add support for MDB");
                }
                processorTarget.addDeploymentProcessor(..new SessionBeanXmlDescriptorProcessor());
                // Process @DependsOn after the @Singletons have been registered.
                processorTarget.addDeploymentProcessor(..new EjbContextJndiBindingProcessor());
                processorTarget.addDeploymentProcessor(..new StartupAnnotationProcessor());
                processorTarget.addDeploymentProcessor(..new LockAnnotationProcessor());
                processorTarget.addDeploymentProcessor(..new DeclareRolesProcessor());
                processorTarget.addDeploymentProcessor(..new RunAsProcessor());
                processorTarget.addDeploymentProcessor(..new RemoveAnnotationProcessor());
                processorTarget.addDeploymentProcessor(..new AssemblyDescriptorProcessor());
                processorTarget.addDeploymentProcessor(..new SecurityRoleRefDDProcessor());
                processorTarget.addDeploymentProcessor(..new SecurityIdentityDDProcessor());
                processorTarget.addDeploymentProcessor(..new SecurityDomainProcessor());
                processorTarget.addDeploymentProcessor(..new EjbDependencyDeploymentUnitProcessor());
                processorTarget.addDeploymentProcessor(..new EjbConcurrencyProcessor());
                processorTarget.addDeploymentProcessor(..new DenyAllProcessor());
                processorTarget.addDeploymentProcessor(..new ExcludeListDDProcessor());
                processorTarget.addDeploymentProcessor(..new EjbRefProcessor());
                processorTarget.addDeploymentProcessor(..new EjbCleanUpProcessor());
            }
        }, ..);
        if (model.hasDefined()) {
            final String poolName = model.get().asString();
        }
        if (model.hasDefined()) {
            final String poolName = model.get().asString();
        }
        if (model.hasDefined()) {
            final String raName = model.get().asString();
        }
        final ServiceTarget serviceTarget = context.getServiceTarget();
        final EJBUtilities utilities = new EJBUtilities();
        newControllers.add(serviceTarget.addService(.utilities)
                .addDependency(.MetadataRepository.classutilities.getMdrInjector())
                .addListener(verificationHandler)
                .setInitialMode(..)
                .install());
    }
New to GrepCode? Check out our FAQ X