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 | 0 | { |
30 | 0 | this.deploymentService = deploymentService; |
31 | 0 | } |
32 | |
|
33 | |
public Application createApp(String appName) throws IOException |
34 | |
{ |
35 | 0 | AppBloodhound bh = new DefaultAppBloodhound(); |
36 | 0 | final ApplicationDescriptor descriptor = bh.fetch(appName); |
37 | 0 | if (descriptor.isPriviledged()) |
38 | |
{ |
39 | 0 | final PriviledgedMuleApplication delegate = new PriviledgedMuleApplication(appName); |
40 | 0 | delegate.setDeploymentService(deploymentService); |
41 | 0 | return new ApplicationWrapper(delegate); |
42 | |
} |
43 | |
else |
44 | |
{ |
45 | 0 | return new ApplicationWrapper(new DefaultMuleApplication(appName)); |
46 | |
} |
47 | |
} |
48 | |
} |