Coverage Report - org.mule.module.launcher.application.PriviledgedMuleApplication
 
Classes in this File Line Coverage Branch Coverage Complexity
PriviledgedMuleApplication
0%
0/15
0%
0/4
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.module.launcher.application;
 8  
 
 9  
 import org.mule.api.registry.RegistrationException;
 10  
 import org.mule.config.i18n.MessageFactory;
 11  
 import org.mule.module.launcher.DeploymentInitException;
 12  
 import org.mule.module.launcher.DeploymentService;
 13  
 
 14  
 /**
 15  
  *
 16  
  */
 17  
 public class PriviledgedMuleApplication extends DefaultMuleApplication
 18  
 {
 19  
 
 20  
     public static final String REGISTRY_KEY_DEPLOYMENT_SERVICE = "_deploymentService";
 21  
 
 22  
     protected DeploymentService deploymentService;
 23  
 
 24  
     protected PriviledgedMuleApplication(String appName)
 25  
     {
 26  0
         super(appName);
 27  0
     }
 28  
 
 29  
     @Override
 30  
     public void init()
 31  
     {
 32  0
         if (this.deploymentService == null)
 33  
         {
 34  0
             final String msg = String.format("Deployment service ref wasn't provided for privileged app '%s'", getAppName());
 35  0
             throw new DeploymentInitException(MessageFactory.createStaticMessage(msg));
 36  
         }
 37  
 
 38  0
         super.init();
 39  
         try
 40  
         {
 41  0
             if (getDescriptor().isPriviledged())
 42  
             {
 43  0
                 getMuleContext().getRegistry().registerObject(REGISTRY_KEY_DEPLOYMENT_SERVICE, deploymentService);
 44  
             }
 45  
         }
 46  0
         catch (RegistrationException e)
 47  
         {
 48  0
             final String msg = String.format("Failed to init a privileged app: [%s]", getDescriptor().getAppName());
 49  0
             throw new DeploymentInitException(MessageFactory.createStaticMessage(msg), e);
 50  0
         }
 51  0
     }
 52  
 
 53  
     public void setDeploymentService(DeploymentService deploymentService)
 54  
     {
 55  0
         this.deploymentService = deploymentService;
 56  0
     }
 57  
 }