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