1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.launcher.application;
12
13 import org.mule.module.launcher.AppBloodhound;
14 import org.mule.module.launcher.DefaultAppBloodhound;
15 import org.mule.module.launcher.DeploymentService;
16 import org.mule.module.launcher.descriptor.ApplicationDescriptor;
17
18 import java.io.IOException;
19
20
21
22
23
24 public class ApplicationFactory
25 {
26 protected DeploymentService deploymentService;
27
28 public ApplicationFactory(DeploymentService deploymentService)
29 {
30 this.deploymentService = deploymentService;
31 }
32
33 public Application createApp(String appName) throws IOException
34 {
35 AppBloodhound bh = new DefaultAppBloodhound();
36 final ApplicationDescriptor descriptor = bh.fetch(appName);
37 if (descriptor.isPriviledged())
38 {
39 final PriviledgedMuleApplication delegate = new PriviledgedMuleApplication(appName);
40 delegate.setDeploymentService(deploymentService);
41 return new ApplicationWrapper(delegate);
42 }
43 else
44 {
45 return new ApplicationWrapper(new DefaultMuleApplication(appName));
46 }
47 }
48 }