1
2
3
4
5
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
18
19
20 public class ApplicationFactory
21 {
22 protected DeploymentService deploymentService;
23
24 public ApplicationFactory(DeploymentService deploymentService)
25 {
26 this.deploymentService = deploymentService;
27 }
28
29 public Application createApp(String appName) throws IOException
30 {
31 AppBloodhound bh = new DefaultAppBloodhound();
32 final ApplicationDescriptor descriptor = bh.fetch(appName);
33 if (descriptor.isPriviledged())
34 {
35 final PriviledgedMuleApplication delegate = new PriviledgedMuleApplication(appName);
36 delegate.setDeploymentService(deploymentService);
37 return new ApplicationWrapper(delegate);
38 }
39 else
40 {
41 return new ApplicationWrapper(new DefaultMuleApplication(appName));
42 }
43 }
44 }