Coverage Report - org.mule.module.launcher.application.ApplicationFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
ApplicationFactory
0%
0/10
0%
0/2
2
 
 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.module.launcher.AppBloodhound;
 10  
 import org.mule.module.launcher.DefaultAppBloodhound;
 11  
 import org.mule.module.launcher.DeploymentService;
 12  
 import org.mule.module.launcher.descriptor.ApplicationDescriptor;
 13  
 
 14  
 import java.io.IOException;
 15  
 
 16  
 /**
 17  
  * Responsible for creating application objects. E.g. handles the default/priviledged app,
 18  
  * wrapper objects, etc.
 19  
  */
 20  
 public class ApplicationFactory
 21  
 {
 22  
     protected DeploymentService deploymentService;
 23  
 
 24  
     public ApplicationFactory(DeploymentService deploymentService)
 25  0
     {
 26  0
         this.deploymentService = deploymentService;
 27  0
     }
 28  
 
 29  
     public Application createApp(String appName) throws IOException
 30  
     {
 31  0
         AppBloodhound bh = new DefaultAppBloodhound();
 32  0
         final ApplicationDescriptor descriptor = bh.fetch(appName);
 33  0
         if (descriptor.isPriviledged())
 34  
         {
 35  0
             final PriviledgedMuleApplication delegate = new PriviledgedMuleApplication(appName);
 36  0
             delegate.setDeploymentService(deploymentService);
 37  0
             return new ApplicationWrapper(delegate);
 38  
         }
 39  
         else
 40  
         {
 41  0
             return new ApplicationWrapper(new DefaultMuleApplication(appName));
 42  
         }
 43  
     }
 44  
 }